For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2007 > IO::Socket::INET client hangs on no server on windoze









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author IO::Socket::INET client hangs on no server on windoze
kenTk

2007-05-28, 6:58 pm

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=GL
OB(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::I
NET=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

Ameree8

2007-05-29, 4:17 am

Why pay for membership at adult sites? Makes your video yourself! Just like I did, watch this full-size sample:
http://www.xx-amateur-movies.org/vid/218571/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com