Solved

Use ping to check if ip is alive?

Posted on 1999-01-15
1
1,942 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now