in reply to IO:Socket question... sort of :)

I wrote a TCP server once and struggled with exactly the same problem. Depending on whether you need to support multiple connections simultaneously or not, there are two options:
  • Use IO::Select for non-blocking IO and multiple clients connected simultaneously.
  • Kill the client connection as soon as message is passed.

    There is some happy horseshit to jump around if you implement either one of those methods, like calling fcntl to enforce the non-blocking IO on the operating system level. The examples from Network Programming in Perl are pretty good, I think this book was recommended above.