in reply to Reconnecting to a specific child of a forking server
Depending on your OS it is possible to pass file descriptors between processes (although it does take deep POSIX black magic to do so). Find a copy of Stevens' Advanced Programming in the UNIX Environment and look in chapter 15 for Passing File Descriptors (p 479 in my copy). You could accept the connection in the master server process, look up which child if any handled that client previously in a hash, and then pass the socket off to whichever child (or one picked at random for a new client).
|
|---|