in reply to IO::Socket::INET Timeout Issue

Can you reduce this to a test case using IO::Socket::INET itself and not relying on Net::FTP? The Timeout field here is (as I understand) exactly as you expect: It's the number of seconds it should wait before giving up.

Replies are listed 'Best First'.
Re: Re: IO::Socket::INET Timeout Issue
by Hrunting (Pilgrim) on Feb 07, 2001 at 00:49 UTC
    Yeah, I did that. That's how I determined that the problem was with IO::Select::INET and not with anything else. My test code was:
    #!/usr/bin/perl use strict; use IO::Select::INET; my $sock = IO::Select::INET->new( PeerAddr => '(host)', # where host is some host I knew PeerPort => 'ftp(21)', # or http(80) or whatever Proto => 'tcp' ); print defined $sock ? 'Connected!' : $@, "\n"; exit 0;
    And then again with Timeout => 0 and Timeout => 120. It was successful on all of them except for Timeout => 120, which it failed to connect (and not after 120 seconds).

    Might I add to this that the reason IO::Socket::INET is giving for not creating the socket (as returned by $@) is 'IO::Socket::INET: Timeout'. Since I can connect when no Timeout is specified, I think I've at least narrowed it down to a problem within the module and not something en route causing a connection failure.

      5.6 on Solaris runs your test code fine (except I changed 'use IO::Select::INET' to 'use IO::Socket' and 'IO::Select::INET->new' to 'IO::Socket::INET->new'), with no timeout specified, 0, 120, 500, whatever.

      I'm curious what version of IO::Socket you have on your system? I'm using 1.1602 here.

        Yeah, sorry, that was not a cut and paste.

        The version of IO::Socket::INET is 1.25 and the version of IO::Socket is 1.26. Like I said, it's a fresh install of the latest stable tarball from CPAN.