http://www.perlmonks.org?node_id=969431


in reply to Re^13: UDP connection
in thread UDP connection

Try this:

#! perl -slw use strict; use threads; use IO::Socket; $|++; use constant SERVER => '127.0.0.1'; use constant MAXIN => 65536; my $noBlock = 1; my @svrs = map{ IO::Socket::INET->new( Proto => 'udp', PeerHost => SERVER, PeerPort => $_ ) or die $!; } 8003, 8008, 8019, 8020; for my $svr ( @svrs ) { async { open my $lsn, '<&', fileno( $svr ) or die "$!,/ $^E"; ioctl( $lsn, 0x8004667e, \$noBlock ); while( 1 ) { select'','','',0.1; recv( $lsn, my $in, MAXIN, 0 ); next unless length $in; next if length( $in ) == 1 and ord( $in ) == 25; print "<$in"; } }->detach; } while( sleep 5 ) { $_->send( chr( 1 ) ) for @svrs; }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?