#!/usr/bin/perl use IO::Socket; $sock = IO::Socket::INET->new( PeerAddr => '192.168.0.4', PeerPort => 4000, Proto => 'tcp' ); $flags = fcntl($sock, F_GETFL, 0) or die "Can't get flags for socket: $!\n"; fcntl($sock, F_SETFL, $flags | O_NONBLOCK) or die "Can't make socket nonblocking: $!\n"; print $sock "logn 0607daimuntemp123\n"; while(1) { sleep 1; $str = <$sock>; chomp $str; print $str . "\n"; if( $str =~ /^$/ ) { print "null\n"; } }