LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 04: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, 06: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,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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, 03:39 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

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


Reply



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 02:39 PM
Subject: Wireless problem: can ping but can't connect; related to linux-backports- Leo Simon Linux - Networking 3 05-30-2009 09:11 PM
ping problem in mandrake linux 2.6.3 karakartal Linux - Networking 2 10-13-2006 04:33 AM
LInux can ping other PC but others cannot Ping Linux Box wayldfayr Linux - Networking 8 10-17-2005 12: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 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Open Source Consulting | Domain Registration