[Mono-list] handling io to a descriptor in *nix

Jonathan Pryor jonpryor at vt.edu
Mon Mar 26 16:55:54 EDT 2007


On Sun, 2007-03-25 at 00:25 -0700, Michael J. Ryan wrote:
> Two external methods... 1, send a byte array via a socket descriptor.. 2, 
> receive a single byte via a descriptor?  I wrote a small stub in C to handle 
> this, but wasn't sure if it would be better to have a compile setting in the 
> C# project itself to address to winsock on windows, and ??? on linux...  That 
> way another dll/so doesn't need to be compiled in the native platform for this 
> tiny piece.

What functions are you using to send/receive data in your C program?  If
you're using read(2)/write(2), then you can use Mono.Unix.UnixStream (in
Mono.Posix.dll) to read/write from the file descriptor.

If you're using send(2)/recv(2), then you'll have to do your own
P/Invoking, as Mono.Posix.dll doesn't wrap sockets yet.

 - Jon




More information about the Mono-list mailing list