in reply to Writing a simple TCP server and connection handling

As far as detecting disconnects goes, you might be able to incorporate the socket method "connected" in your loops to constantly monitor for a disconnect. See $Socket->connected Not Returning False? It shows how to use sysread and EAGAIN.

Also, you don't seem to use IO::Select or select itself, and it has very useful can_read, can_write, and timeout tests available to use. Also see Knowing when a socket connection is dead


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: Writing a simple TCP server and connection handling