IO::Socket::INET client hangs on no server on windoze
- From: ken@xxxxxxxxxxx (kenTk)
- Date: 28 May 2007 08:28:35 -0700
If there is no server or no connection this hangs for about 20 seconds
and then crashes with the following error message.
The Timeout seems to make no difference and the 'warn' does not occur.
If works file with a good connection to a server.
Using 5.8.8 active perl.
Anyone got any suggestions for making it return undef in an orderly
fashion?
(I have tested it on Linux and it seems to work fine both ways)
use strict;
use warnings;
use IO::Socket::INET;
sub testSocket
{
my $sock;
my $ok=0;
unless( $sock=IO::Socket::INET->new(192.168.5.41,
PeerPort => '21',
Proto => 'tcp',
Timeout =>'3'))
{ warn 'Cant connect'; }
else
{ $sock->close; $ok=1; }
return $ok;
}
error messages:
No errno EINPROGRESS at C:/Perl/site/lib/Errno.pm line 82
Errno::FETCH('Errno=ARRAY(0x1bc1790)', 'EINPROGRESS') called
at C:/Perl/lib/IO/Socket.pm line 115
IO::Socket::connect('IO::Socket::INET=GLOB(0x35e55e0)',
'\x{2}\x{0}\x{0}\x{15}\x{c0}\x{a8}\x{5})\x{0}\x{0}\x
{0}\x{0}\x{0}\x{0}\x{0}\x{0}') called at C:/Perl/lib/IO/Socket/INET.pm
line 257
IO::Socket::INET::connect('IO::Socket::INET=GLOB(0x35e55e0)',
'\x{2}\x{0}\x{0}\x{15}\x{c0}\x{a8}\x{5})\x{0}\
x{0}\x{0}\x{0}\x{0}\x{0}\x{0}\x{0}') called at C:/Perl/lib/IO/Socket/
INET.pm line 232
IO::Socket::INET::configure('IO::Socket::INET=GLOB(0x35e55e0)',
'HASH(0x1b21384)') called at C:/Perl/lib/IO/
Socket.pm line 48
IO::Socket::new('IO::Socket::INET', 'PeerAddr', 192.168.5.41,
'PeerPort', 21, 'Proto', 'tcp', 'Timeout', 3,
....) called at C:/Perl/lib/IO/Socket/INET.pm line 37
IO::Socket::INET::new('IO::Socket::INET', 'PeerAddr',
192.168.5.41, 'PeerPort', 21, 'Proto', 'tcp', 'Timeout
', 3, ...) called at spTools01.pl line 222
main::testSocket called at spTools01.pl line 61
.
- Prev by Date: Re: Array of Array refs
- Next by Date: Re: PDF File
- Previous by thread: Accessing hash
- Next by thread: Re: IO::Socket::INET client hangs on no server on windoze
- Index(es):
Relevant Pages
|
|