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



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

.



Relevant Pages

  • Re: web serivce: client side timeout?
    ... client side but only from the server side. ... System.Net.Sockets.SocketException: A connection attempt failed ... asyncResult, Int32 timeout, Exception& exception) ... John Saunders | MVP - Windows Server System - Connected System ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server i
    ... This does not look like a Connection Pool issue--the message returned by the ... errors are traditionally caused when SQL Server is loaded beyond capacity. ... Message: Timeout expired. ... it appears that this error is more of a TCP/IP type ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Problem removing Active Directory
    ... error message because the child domain seems to have left a "ghost" within ... Determine the domain controller that holds the Domain Naming Master ... to the specific server on which the changes will occur. ... You should receive confirmation that the connection is ...
    (microsoft.public.windows.server.general)
  • Sql Server Connection Irritations (again)
    ... framework 1.x and even the same code that fails in framework 2.0, ... All our servers are Windows Server 2003 and all our SQL Server databases are ... A connection was successfully established with the server, ... The <SNIX error message> portion of our error message is: ...
    (microsoft.public.dotnet.framework.adonet)
  • Sql Server Connection Irritations (again)
    ... framework 1.x and even the same code that fails in framework 2.0, ... All our servers are Windows Server 2003 and all our SQL Server databases are ... A connection was successfully established with the server, ... The <SNIX error message> portion of our error message is: ...
    (microsoft.public.dotnet.framework.adonet)