in reply to Why sysread() + select() only read the first line?

My guess is that you are suffering from buffering (on STDOUT -- sockets aren't buffered). Try adding the following at the top of your code:

$|= 1;

- tye