Server
#!/usr/bin/perl -w use strict; use IO::Socket; use IO::Select; my $sock=new IO::Socket::INET (Localhost => '127.0.0.1', LocalPort => '4000', Proto => 'tcp', Listen => 5, ReuseAddr => 1, ); die "Socket could not be created. Reason $!" unless $sock; my $pread = IO::Select->new; my $pwrite = IO::Select->new; my $pexceptions = IO::Select->new; while (1) { print "1\n"; my ( $read, $write, $exceptions ) = IO::Select->select( $pread, $pwr +ite, $pexceptions ); print "2\n"; } close($sock);
[download]