in reply to Sending & Receiving on a socket

try autoflush:
select (SERVER); $| = 1; select (STDOUT);