Solved

Use ping to check if ip is alive?

Posted on 1999-01-15
1
1,977 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Handling case and special names in javascript 3 52
SSRS - Powershell 7 81
convert Systemjs to Webpack 3 130
Help with Progress 4gl Rounding Function 6 61
In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

710 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