LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ping code (https://www.linuxquestions.org/questions/programming-9/ping-code-575200/)

ilnli 08-06-2007 05:01 PM

ping code
 
Can anyone give me the easy code of ping command can I need it to see whether a machine is up or down in my code, I've found loads of ping code but all of them are very large and complex I need a simple one that can do the task.

Please Help,


Regards,
Imran

ilnli 08-06-2007 05:05 PM

or is there any library or function in C that can do the task of ping then please let me know.

thank you.

regards,
Imran

wjevans_7d1@yahoo.co 08-06-2007 08:44 PM

The simplest ping program you're likely ever to find is at

http://www.unpbook.com/src.html

Hope this helps.

ilnli 08-07-2007 05:42 PM

is there any library/systemcall that I can use to accomplish a ping ?

rstewart 08-08-2007 10:34 AM

Why don't you look at the Linux source for the ping command? Basically, it is a very simple ICMP echo request/echo response.

ilnli 08-08-2007 05:08 PM

I've looked at it its a bit kind of complex code so I was thinking that instead of copying that whole code in my program there might be a library available for that.

exvor 08-08-2007 07:50 PM

Pining a system via a network connection is not a simple task this is why the examples you are seeing are complicated.


As far as I know there is no system library that can accomplish this ( it is worth noting that there very well might be one on some exotic system) You can of course always write your own library.

or just use the system function but its not recommended.

ilnli 08-08-2007 09:04 PM

ok thanks guys I'll use the existing code in my project.

thank you all

wjevans_7d1@yahoo.co 08-09-2007 01:36 AM

To avoid trouble, make sure that you comply with the license terms accompanying any code you borrow.

Just a thought.

ilnli 08-09-2007 07:34 AM

right, thanks


All times are GMT -5. The time now is 07:03 AM.