agoth has asked for the wisdom of the Perl Monks concerning the following question:
On the port range I have chosen, the response seems to alternate and not be the same each time, I have waded back and forth through the perldoc and the cookbook for a clue, to no avail, so is it a problem with my use of the IO modules?
I am getting:
READ *3* READ *0* Read IO select timed out at ./socket.pl line 24. READ *3* READ *0* Read IO select timed out at ./socket.pl line 24
when instead I want four dies in a row.... code below:
#!/usr/local/bin/perl -w use strict; use IO::Select; use IO::Socket; my $server = '127.0.0.1'; for (8721 .. 8724) { my $fd = new IO::Socket::INET( PeerAddr => $server, PeerPort => $_, Proto => 'udp'); my $sockin = new IO::Select( $fd ); eval { $fd->send( 'Test string' ); my $read = IO::Select->select( $sockin, undef, undef, 3); print "READ *$read*\n"; die "IO select timed out" unless $read; }; print "Read $@" if $@; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Socket response inconsistent
by Cubes (Pilgrim) on Jul 31, 2001 at 18:08 UTC | |
by agoth (Chaplain) on Jul 31, 2001 at 19:08 UTC | |
by Cubes (Pilgrim) on Jul 31, 2001 at 19:45 UTC |