[Mono-dev] Pull request 1977 (socket functions for Mono.Posix)

Steffen Kieß Steffen.Kiess at ipvs.uni-stuttgart.de
Fri Aug 14 16:47:11 UTC 2015


Hello,

I've created a pull request which adds socket-related functions and data 
structures to Mono.Posix.
https://github.com/mono/mono/pull/1977

This is evertything from <sys/socket.h> and the structures sockaddr_in, 
sockaddr_in6 and sockaddr_un.

A few comments regarding the implementation:
- sockaddr_* is passed into and out of the functions as a byte[] (+ a 
long for the length of the data). This is because the actual type of the 
data is unknown, as it depends on the address family. The Sockaddr* 
structures can be used to create or inspect such a byte[].
- control messages are also treated as an opaque byte sequence, which 
can be created or inspected with the CMSG_* macros. The unit tests 
contain an example for sending file descriptors over a socket using 
SCM_RIGHTS
- The enums (e.g. SockType) have been named in a way to avoid conflicts 
when importing the namespaces System.Net or System.Net.Sockets and 
Mono.Unix.Native. (Several files in the mono repository do this, 
probably also projects outside the mono repository do the same thing.)

If you have any questions / comments or want me to change something 
please tell me so.


Best regards,
Steffen Kieß


More information about the Mono-devel-list mailing list