So I wonder - is it possible to pass accepted TCP connection (on Windows or Unix like OS) from one process to another? Here the point is to pass connection - not data in a way a proxy app would.
On Windows, use WSADuplicateSocket
, pass the filled in WSAPROTOCOL_INFO
to the other process, use WSPSocket
to recreate a socket.
On unix-like OS'es this is possible using the sendmsg()
system call. libancillary abstracts this for you.