I'll rephrase your question first, just in case i'm misinterpreting it: Net:ing tells me if a server is alive.
How can i tell that it cannot be reached?
If this is your questing, the answer is:
[tt]$p = Net:ing->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
[/tt]
that is, the return of ping() determines if it can be reached or not.
returns 1 means it can be reached.
returns 0 means it cannot be reached.
If that was not your question, please enter it again to clear up any discrepancies.
"If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
My trouble is the following :
I want to know if I can reach the server named "toto".
The system ping (ping toto) answer me : "toto is alive"
$serveur = "toto";
$p = Net:ing->new();
$p->ping($serveur); answer me : "toto is unreachable"
$p->close();
So, I don't undestand why the answer from perl and system is different.
Ah, so Net:ing is failing. I don't know that it has any particular failings. It may be you need to format the name differently when supplying it to the Ping function. Another easier solution might be to use the system command:
[tt]
$p = system "ping toto";
[/tt]
but the return value will be weird for system(look it up in the perldocs to make sure you interpret it correctly, or even find the source in Net:ing that does the interpreting on it's own).
that's my best guess; hope it helps.
"If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
That's strange... i'll read the known bugs on Net:ing, and you might want to as well.
Are you able to work with the system("ping" contruct?
What system are you working on?
...
"If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.