Ashish Bhadiyadra
Ashish Bhadiyadra

Reputation: 71

How to implement ping request in C language for Windows platform?

I want to implement ping request in C language. I am working on Windows platform. Can any one suggest how to implement it or if code is already available then from where I can find it?

Upvotes: 2

Views: 4365

Answers (2)

gimel
gimel

Reputation: 86492

Highly useful and open source - fping.

fping is a ping(1) like program which uses the Internet Control Message Protocol (ICMP) echo request to determine if a host is up. fping is different from ping in that you can specify any number of hosts on the command line, or specify a file containing the lists of hosts to ping. Instead of trying one host until it timeouts or replies, fping will send out a ping packet and move on to the next host in a round-robin fashion. If a host replies, it is noted and removed from the list of hosts to check. If a host does not respond within a certain time limit and/or retry limit it will be considered unreachable.

Unlike ping, fping is meant to be used in scripts and its output is easy to parse.

Upvotes: 2

Florian Greinacher
Florian Greinacher

Reputation: 14784

You can use system() to run command line instructions. So something like

system("ping 127.0.0.1") 

should work.

Upvotes: 0

Related Questions