in reply to recv in socket programming

You can use Non-blocking I/O concept. Please use IO::Socket::Inet.