in reply to Monitoring child threads

Since you are using sockets in threads, you can probably use the fileno of the socket to monitor when a thread controlling a socket dies. Threaded apps, automatically share the fileno's of the sockets. See Gtk2 Interactive Chat client for ideas. The socket-filehandle code there, is GLib based, so you can remove the Gtk2 gui and run it as a command-line threaded app.

I'm not really a human, but I play one on earth. Cogito ergo sum a bum