Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
make auto pinging program

Reply  
Thread Tools
astoristz's Avatar
Junior Member with 1 posts.
 
Join Date: Sep 2006
Experience: Beginner
20-Sep-2006, 11:24 PM #1
make auto pinging program
can anyone help me to make an auto pinging program with C?
im trying to make a program that ping a computer continuously so that i knew when that computer is down. i want to add the result of ping to a file. it should be better that the program doesn't use things like bash shell or something, i don't know the name
thanks very much
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
21-Sep-2006, 11:01 PM #2
Why not use a shell script. This is perfect solution for this.
lotuseclat79's Avatar
Distinguished Member with 21,345 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
22-Sep-2006, 02:55 PM #3
Hi astoristz,

I have to agree with Squashman that a shell script would be easiest solution for this problem without more details.

Perhaps you could explain the context for the use of the program. If it only involves you at a desktop and is not a part of some application, then the shell approach is probably best. On the other hand, if it is to be a part of an application that is already coded in C, then C would be the way to go.

Bash understands sh, and zsh, and you can certainly specify the shell language inside the script you or someone else writes.

Perhaps even easier is if you know the IP address of the computer you want to ping, then inside your shell, you can make an alias to do the ping for you. As an example, inside your shell: This example assumes the csh is used:
In the file residing in your $HOME directory that is named, ".cshrc", put the following line:
alias poke "ping <ipaddress>"

and substitute the real ip address of the computer for <ipaddress>.

Then from your shell window, just issue the poke command (assumes poke is not a command available in your shell $PATH), as in:

$ poke

which your shell then replaces with "ping <the ipaddress you substituted>" before it executes the ping command.

-- Tom
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction
between a mere artisan or specialist and a real seeker after truth. - Einstein 1944
Imagination is more important than knowledge. - Einstein
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:04 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.