Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IO::Socket::INET Timeout

Status
Not open for further replies.

GrahamBright

Programmer
Oct 31, 2003
65
AT
Hi,

I'm trying to get more information regarding the timeout method of IO::Socket::INET. I've writing a problem to test if a connection can be established to a remote system, returning true if all is fine and false if the connection fails.

but I can't get Timeout to work with a specific value. Instead when testing a remote conneciton which fails, the program returns false after around 3 minutes.

Is there a way to test if a n/w connection is available with a quicker response of failed, say after 10 seconds?

docs don't provide specific examples of how to use Timeout
CPAN>>
Timeout Timeout value for various operations

Thanks in advance.

Graham.

 
Hi,

Think I found a way of accomplishing my task using Net::Telnet

use Net::Telnet;


$t = Net::Telnet->new(Timeout => 5, Port => 25, Host => "smtp\.a1\.net", Errmode=> sub {&error;});

sub error
{
print "Connection Failed!\n";
exit;
}

Any suggestions on improvements.

Thanks in advance,

Graham.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top