LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ping problem in LINUX (https://www.linuxquestions.org/questions/linux-newbie-8/ping-problem-in-linux-812104/)

nirucool89 06-04-2010 04:27 AM

Ping problem in LINUX
 
hello,
i run the ping command using system() in C..its start pinging the desired destination bt when i close my application it continues to ping...is there any solution dat as soon as i close my application it also stops pinging...ny change required in my C code..?
plz reply..thanks 4 ur tym...

tronayne 06-04-2010 06:23 AM

In your program, add -c 5 to the ping command; that'll stop after five pings (otherwise, ping will go on forever).

Also, rather than using the system() function, look into the exec() family of functions (but use the -c argument!).

jefro 06-04-2010 03:39 PM

Add kill at end?


All times are GMT -5. The time now is 08:55 AM.