|
Home > Archive > Unix Programming > May 2006 > ping program to probe a remote system
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ping program to probe a remote system
|
|
| xoinki 2006-05-15, 1:16 pm |
| hi experts,
i have a ping program written in c on linux platform. it is working
fine but it has a bug.lets say i am probing a remote system with IP
192.168.15.1. every second ICMP datagram is sent. now if i deactivate
the NIC then the ping just stops and does not return any error message.
It works fine if i use unicast address and select works fine .. but if
i use a broadcast IP (192.168.15.255) then the ping just hangs up if
the destination system is suddenly shutdown or NIC is deactivated.
although ethereal flags an error message that the network is down, my
program is not able handle this condition. the code is too large to
post here (400+ lines).
please help me..
waitin for u r replies.
Xoinki
| |
| Maurizio Loreti 2006-05-15, 1:16 pm |
| try a single ping without waiting; in a (bash) shell script,
if ping -q -c 1 -w 1 hostname >/dev/null 2>&1
then echo "OK"
else echo "FAILED"
fi
--
Maurizio Loreti http://www.pd.infn.it/~loreti/mlo.html
Dept. of Physics, Univ. of Padova, Italy ROT13: ybergv@cq.vasa.vg
|
|
|
|
|