LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-04-2010, 05:27 AM   #1
nirucool89
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Rep: Reputation: 0
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...
 
Old 06-04-2010, 07:23 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,479

Rep: Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020
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!).
 
Old 06-04-2010, 04:39 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,388

Rep: Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199
Add kill at end?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 15 03-30-2015 03:39 PM
Subject: Wireless problem: can ping but can't connect; related to linux-backports- Leo Simon Linux - Networking 3 05-30-2009 10:11 PM
ping problem in mandrake linux 2.6.3 karakartal Linux - Networking 2 10-13-2006 05:33 AM
LInux can ping other PC but others cannot Ping Linux Box wayldfayr Linux - Networking 8 10-17-2005 01:20 PM
i am newbie please help i hav problem with crap ping on server will linux help Numpty Linux - Newbie 4 01-29-2005 07:30 AM


All times are GMT -5. The time now is 02:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration