On Aug 24, 2012, at 3:51 AM, Miljenko Cvjetko <mcvje...@holisticware.net> wrote:
> If we look into
> https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Sockets/Socket.cs

Wrong branch; Mono for Android is based on Mono 2.10, not master:

        
https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket.cs

I'm still not sure why line 1446 is still wrong, but it does show us what the 
issue is; he's calling:

        IOControl(IOControlCode.KeepAliveValues, tcpKeepAlive.ToArray(), null);

Which means he's calling the IOControl(IOControlCode, byte[], byte[]) overload:

        
https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket.cs#L1461

This overload does nothing, and simply throws NotImplementedException, which is 
what he's seeing. Oops.

The fix is to do what master does: call the IOControl(int, byte[], byte[]) 
overload, which is implemented:

        IOControl ((int) IOControlCode.KeepAliveValues, tcpKeepAlive.ToArray(), 
null);

> No we can wonder if that is because MA is superset of Silverlight/Moonlight 
> and Silverlight introduced sockets in v 4 as far as I can remember and 
> probably has some restrictions. So the mono team decided to follow those 
> restrictions what if hard to believe...

For future "research" purposes, when trying to determine which code is present 
in Mono for Android, you'll need to know:

1. The correct branch, in this case the mono-2-10 branch. (We'll eventually 
rebase atop 2.12, once that's out + ~6 months...)

2. Which files are included for a given assembly, which are listed in the 
mcs/class/ASSEMBLY/monodroid_ASSEMBLY.dll.sources file:

        
https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/monodroid_System.dll.sources

Note that csc has an extension to #include the contents of other files, so for 
System.dll we also need:

        
https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/mobile_System.dll.sources

3. Which #defines are set, generally NET_2_0, NET_2_1, MOBILE, and MONODROID. 
Based on that we can see that the Socket(SocketInformation) constructor won't 
be provided:

        
https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket.cs#L184

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to