in reply to Re: fcntl on Windows
in thread fcntl on Windows
#!/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"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: fcntl on Windows
by Adam (Vicar) on Mar 21, 2001 at 00:59 UTC | |
by Daimun (Novice) on Mar 21, 2001 at 01:11 UTC | |
by Daimun (Novice) on Mar 21, 2001 at 01:16 UTC | |
by Adam (Vicar) on Mar 21, 2001 at 01:23 UTC |