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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net Ping Not Timing Out

Status
Not open for further replies.

chitownclone

Programmer
Mar 30, 2004
22
0
0
US
Anyone have an idea why some timeout is not working on some domain names that I Ping? There are certain DNs that are not active that take 20 seconds to timeout, even though I have it set to 1 or 2 seconds (I tried setting the timeout 2 different ways).

Is it the number of Pings it is sending before timeout or something else?

Thanks

Code:
$p = Net::Ping->new("syn");
$p->{port_num} = getservbyname("http", "tcp");
$p->ping($url, 1);
($host,$rtt,$ip) = $p->ack; 
$p->close();


$p = Net::Ping->new("syn", 2);
$p->{port_num} = getservbyname("http", "tcp");
$p->ping($url);
($host,$rtt,$ip) = $p->ack; 
$p->close();
 
I think its because the Net-Ping module sets the ping protocol as "TCP" which either way, it takes longer to complete, so it takes longer to timeout. Try to set the protocol as "ICMP" when you create the ping object and see what happens.

TIMTOWTDI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top