Solved

Use ping to check if ip is alive?

Posted on 1999-01-15
1
1,967 Views
Last Modified: 2013-12-25
Hi!
  I have a C script using ping to check if an ip address is alive... i'm using this code:

  int result;
  result = system("ping -c 2 ipaddresshere");

but i can't get the correct value of result...

can you give me another way of making a C script so that it will view to me if an ip is alive through an html?

please help me!!!

Faceless
0
Comment
Question by:faceless
1 Comment
 
LVL 1

Accepted Solution

by:
chump earned 50 total points
ID: 1830689
Using some kind of Unix?
I'm using this with Linux:

int result;
result = system( "ping -c 2 ipaddress | grep -e '100% packet loss'" );

If ping is successful, result will be 256.
If all 2 ping packets get lost, the result is 0.

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Powershell / new-object PSObject rows 2 465
Combine DSQuery result into loop script 6 69
Bulk Reorder File Names 4 69
convert Systemjs to Webpack 3 33
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question