sysread returns 0, only when the other end exits. Getting into blocking mode, which is not desired.
I expect the program to wait in select not in sysread.
Comment on Re^4: IO::Select - reading multiple lines
You might be interested in trying ioctl, see IPC3 buffer limit problem. You can google for ioctl on sockets and let your mind get boggled, and yearn for the simplicity of <>. :-)