3

I need to pass a socket descriptor to another process on Linux using Mono. On Windows this is easily accomplished using Socket.DuplicateAndClose(int). I have found this post describing the process in c:

Can I share a file descriptor to another process on linux or are they local to the process?

In my program I have been able to create Unix sockets between two Mono programs using Mono.Unix and Mono.Unix.Native namespaces. I have been able to find some details that are roughly similar here:

http://svn.aircrack-ng.org/trunk/lib/csharp/MonoExample/NDesk-dbus/

I am still getting an EINVAL error when I try to send a socket descriptor. Does someone have a sample of this working?

Community
  • 1
  • 1
John
  • 791
  • 1
  • 6
  • 22
  • Can you show the code you have for the sockets so far? This shouldn't be too hard: you just need to use the `sendmsg(2)` and `recvmsg(2)` functions to pass around the socket descriptor to the other processes. You're doing this in Linux/UNIX, right? – Filipe Gonçalves Aug 23 '15 at 15:09

0 Answers0