in reply to Re: Re: ping problem
in thread ping problem

so thanks for ur help but i have other problem: Hi dear I am using Redhat 7.3 and SuSE8.0 and i want to ping on special port a server to know is it alive or not. at the first, when i run the example on cpan.org(Net::ping) it doesnt answer any, i download this module and installed it, then ping(icmp) replay. but when i want to ping on specified port with tcp or syn portocol it replay ok(no differnce that service is up or down). i mean this code: $p = Net::Ping->new("tcp", 2); # Try connecting to the www port instead of the echo port $p->{port_num} = getservbyname("http", "tcp"); #while ($stop_time > time()) #{ print "$host not reachable ", scalar(localtime()), "\n" unless $p->ping($host); sleep(3); #} undef($p); it respond ok no difrence that http service is up or down . i use ur fping : ./fping 192.168.100.12 -P 80 it shows alive in each time that service is up or down. how could i solve the problem. and what is my fault. why it shows host is alive in each time. it is important for me. Best regurds R.A

Replies are listed 'Best First'.
Re^4: ping problem
by mowgli (Friar) on Mar 04, 2003 at 13:24 UTC

    From what you write, I'm not sure whether your test code above always reports that the host is down or that it's up, but when I tried this myself, I found that Net::Ping doesn't seem to work when $host is specified as v127.0.0.1; setting it to "localhost" works, though, so you might want to try that. Outside of that, you might also consider asking a new question in Seekers of Perl Wisdom about this; I'm sure you'd get more replies that way. :)

    --
    mowgli