in reply to read from socket blocks until buffer is full

Maybe you want to set the sockets to nonblocking? Then you can read as much data as there is for the moment.

Also consider looking at the IO (and event) multiplexing frameworks, like AnyEvent, POE and IO::Async. If you prefer to roll your own, IO::Select is a good basis for a start.

  • Comment on Re: read from socket blocks until buffer is full