The retrun of the ping command

Status
Not open for further replies.

julian403

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':


 

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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…