ggeorgak |
02-02-2007 10:26 PM |
strange behavior using system() and ping utility
I am executing system("ping -c 1 -w 1 192.168.1.66"). Supposedly pinging stops either when an ECHO_REPLY has been received or the deadline of 1 second has passed. The strange thing is that the program keeps pinging even though both flags are violated, the scenario is that I have a lan node that gets connected and disconnected from the network. Using Ctrl+C to stop the ping fork process(meaning the system fork process I don't create a new one) I see that it keeps pinging meaning more ECHO_REQUESTS than 1 are sent and the time restriction of 1 second is definitely surpassed.Any ideas of why this is happening?
I forgot to mention that I'm using a SIGALRM handler to call a function that in turn calls system(...). Could this have to do anything with the problem? If yes in what way?
|