$self->{SOCK} = new IO::Socket::INET(LocalPort=>$port, Proto=>"tcp", Listen=>10, Reuse=>1, Blocking=>0); #### ############################################################################### # # _nonblock - given a socket, make it non-blocking # ############################################################################### sub _nonblock { my $self = shift; my $socket = shift; #-------------------------------------------------------------------------- # Code copied from POE::Wheel::SocketFactory... # Win32 does things one way... #-------------------------------------------------------------------------- if ($^O eq "MSWin32") { ioctl( $socket, 0x80000000 | (4 << 16) | (ord('f') << 8) | 126, 1) || croak("Can't make socket nonblocking (win32): $!"); return; } #-------------------------------------------------------------------------- # And UNIX does them another #-------------------------------------------------------------------------- my $flags = fcntl($socket, F_GETFL, 0) || croak("Can't get flags for socket: $!\n"); fcntl($socket, F_SETFL, $flags | O_NONBLOCK) || croak("Can't make socket nonblocking: $!\n"); }