I believe this fixes all the issues identified by the reviewers, and also avoids leaking a few data items.
I also added some fixes for things that seemed sub-optimal. The biggest was that there was no way to tell from the monitor whether a socket was connected or not. Patch 4 sets the filename to "disconnected:<addr>" when the socket disconnects, were <addr> is the address supplied by the user. Changing "256' to a #define also seemed like a good idea. It also seems like a good idea to me to print out the peer address of a socket. That's the last patch, so it can be easily dropped if this is not wanted. Thanks all, -corey