Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

The retrun of the ping command

Status
Not open for further replies.

julian403

Full Member level 5
Full Member level 5
Joined
Feb 28, 2014
Messages
254
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Location
Argentina
Activity points
2,105
Hello, I'm doing a problem which test the host in a network. For that I do a ping of the ip which are in a file. But I couldn't find what are the ping commands return. It's return the number of ping succesfull?

Regards.
 

Re: the retrun of the ping command

Thanks but that not response my question. For example:

Code:
 int i;
    i= system("ping www.google.com");


What value get i? Sometimes it gets 0 and other times difference value without a reason.
 

Re: the retrun of the ping command

In Macintosh there are Network utility programs which have an option to ping addresses. Type the address into one window, and another window tells whether successful or not, and displays a time measurement. I'm not sure which program is available in PC's for doing the same thing, but there probably is a control panel or other free network utility.

- - - Updated - - -

Example inputting 'www.google.com':


Ping has started ...

PING www.google.com (172.217.1.36): 56 data bytes
64 bytes from 172.217.1.36: icmp_seq=0 ttl=55 time=16.068 ms
64 bytes from 172.217.1.36: icmp_seq=1 ttl=55 time=15.881 ms

--- www.google.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 15.881/15.975/16.068/0.093 ms
 

Re: the retrun of the ping command

Hi,

Are you talking about a PC command called "ping" and it's response on the screen?

Or the HTTP command "ping" and it's response?

Klaus
 

Re: the retrun of the ping command

Icmp protocol but I think I got it. Ping return 0 when there is a echo responce and let say that it return other number when not
 

Re: the retrun of the ping command

is this the exit code? if so 0 normally means "success" as there is only one way to succeed and non zero means fail with the value being related to why the command failed.
 
Re: the retrun of the ping command

Hi,

Your posts are confusing.
i= system("ping www.google.com");
Here you are usung a PC command "ping" ...and i is the response of the PC command (function).
It's very usual that afunction returns "0" when there is no error.

Icmp protocol but ...
But this is something different.
You may see the ICMP "ping" when you use an ethernet analyzer tool like ethershark.

Klaus
 

Re: the retrun of the ping command

Not sure if the ping command generates a useful return code. You can route the ping response to a file or use an ICMP function of the IP Helper API to get the intended info.
 

Re: the retrun of the ping command

Quick google:
0 = good
1 = no response
2 = other

I believe this is what the OP is looking for. I'm guessing 0 = good, 1 = able to transmit ping but no response, and 2+ = it is not clear if a ping was even sent.
 
Re: the retrun of the ping command

Hi,

Quick google:
0 = good
1 = no response
2 = other

I believe this is what the OP is looking for. I'm guessing 0 = good, 1 = able to transmit ping but no response, and 2+ = it is not clear if a ping was even sent.

Maybe you are correct.
But can one be sure that this is true for different OS types and different OS versions?

Klaus
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top