#! 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; }