[Mono-list] Mono Sockets

vladimir at fullyfree.org vladimir at fullyfree.org
Mon Apr 23 16:42:30 EDT 2007


Hello all,

I'm wondering how exactly Mono manages to implement the System.Net.Sockets
namespace in a cross-platform fashion. The reason for this is that I am
wondering whether it would be feasible to implement a protocol (on top of
IP, see RFC 2960) using the SocketType.Raw sockets.

I've had a look at mcs/class/System/System.Net.Sockets/Socket.cs and the
mono runtime in SVN, and it seems that what is being done is the normal
windows socket api calls on non-windows platforms are being re-implemented
using their counterparts (BSD socket calls). I can't find (atm) the actual
*.c file that implements that on *nix (only the .h externs). Could someone
please explain the mechanism in more detail?

There's also some information I was able to find about ICMP raw socket
experiences with Mono/*nix. In particular
http://lists.ximian.com/pipermail/mono-devel-list/2007-April/023065.html
and some messages from 2005 about the same issue.

Is the root restriction applicable to *all* Raw sockets, or just specific
types of protocol (the IP header)?

Of course, the alternative way to go about implementing this protocol
would be to P/Invoke some user-space libraries (there is already an
implementation in the Linux/FreeBSD kernels) and implement using Raw
sockets (in C#) elsewhere.

Regards,
Vladimir Lushnikov





More information about the Mono-list mailing list