[Date Prev][Date Next] [Chronological] [Thread] [Top]

client sockets and fork

There are a couple of things I'd like to be able to do which I don't
see how to do right now.  One is to fork() a process that has an open
connection.  Sometimes you might want to pass the connection on to
the child, or keep it in the parent.  In either case, it would be
prudent to clean up the extra socket connection that gets spawned.
For the child, this could be accomplished by setting the "close on
exec" flag on the file descriptor (assuming you are going to do an
exec).  If the parent is giving up the connection to the child, there
should be some way to do this, ie. clean up all your data structures
but don't send any shutdown messages to the server.

Another case is where I'd like to perform a select() call to wait on
data from the LDAP socket, along with other data I'm waiting for.  The only
answer to this is to be able to retrieve the file descriptor of the
socket.  This would also partially solve the first case, but doesn't
address cleaning up LDAP data structures.

Have I missed something, or is this worth of an ITS report?

Randy Kunkee
NeoSoft Inc.