in reply to Timeout problem using IO::Socket

I know this doesn't really address your problem directly, but....

Have you considered pinging (Net::Ping) the host first to make sure it is alive before you enter the IO::Socket section of your code? It may be much easier than handling the connection timeout the way you want to.

Replies are listed 'Best First'.
RE: Re: Timeout problem using IO::Socket
by geektron (Curate) on Sep 28, 2000 at 02:51 UTC
    Net::Ping would be a problem on UNIX machines. ICMP pings require the script to be run as root. Windows users won't have the same problem.

    You could either try to patch your local version of Net::Ping to disable the root requirement, or use backticks or system to execute the ping.