Networking Forums

Networking Forums > Computer Networking > Linux Networking > "Ping" doesn't work properly

Reply
Thread Tools Display Modes

"Ping" doesn't work properly

 
 
Neel
Guest
Posts: n/a

 
      02-14-2006, 12:30 AM
I only want to send one packet to another host to check whether it is
connected or not. I want to have 2 seconds timeout.

I use, ping -c 1 -w 2 192.168.0.2

If host is not connected, it fails correctly. BUT summary says.

PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data

--------192.168.0.2 ping statastics --------
2 packets transmitted, 0 received, 100% loss, time 999ms

Why 2 packets are sent instead of 1 (specified) and why it only waits
for 999 ms instead of 2 seconds.

Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here
I wanted to send 5 packets but, again 2 packets were sent?

What is wrong here? Please help me.
Thanks a lot

 
Reply With Quote
 
 
 
 
Dennis
Guest
Posts: n/a

 
      02-14-2006, 01:24 AM
-w deadline

Specify a timeout, in seconds, before ping exits regardless of how many
packets have been sent or received. In this case ping does not stop
after count packet are sent, it waits either for deadline expire or until
count probes are answered or for some error notification from network.

I think you want to use:

-t ttl

Set the IP Time to Live.


Neel wrote:

> I only want to send one packet to another host to check whether it is
> connected or not. I want to have 2 seconds timeout.
>
> I use, ping -c 1 -w 2 192.168.0.2
>
> If host is not connected, it fails correctly. BUT summary says.
>
> PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data
>
> --------192.168.0.2 ping statastics --------
> 2 packets transmitted, 0 received, 100% loss, time 999ms
>
> Why 2 packets are sent instead of 1 (specified) and why it only waits
> for 999 ms instead of 2 seconds.
>
> Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here
> I wanted to send 5 packets but, again 2 packets were sent?
>
> What is wrong here? Please help me.
> Thanks a lot


--
Living on Earth may be expensive,
but it includes an annual free trip around the sun.
 
Reply With Quote
 
cga
Guest
Posts: n/a

 
      02-14-2006, 04:55 AM
Neel wrote:
> I only want to send one packet to another host to check whether it is
> connected or not. I want to have 2 seconds timeout.
>
> I use, ping -c 1 -w 2 192.168.0.2
>
> If host is not connected, it fails correctly. BUT summary says.
>
> PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data
>
> --------192.168.0.2 ping statastics --------
> 2 packets transmitted, 0 received, 100% loss, time 999ms
>
> Why 2 packets are sent instead of 1 (specified) and why it only waits
> for 999 ms instead of 2 seconds.
>
> Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here
> I wanted to send 5 packets but, again 2 packets were sent?
>
> What is wrong here? Please help me.
> Thanks a lot
>

the -w flag..?? gives me "invalid option -w" .. on a linux system.
 
Reply With Quote
 
Neel
Guest
Posts: n/a

 
      02-14-2006, 04:52 PM
Thanks Dennis.

but -t doesn't work. I just want to wait for 2 seconds to get my reply
packets back. If not, I want to exit out.

Let me know please

 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      02-14-2006, 06:25 PM
"Neel" <(E-Mail Removed)> wrote:
>I only want to send one packet to another host to check whether it is
>connected or not. I want to have 2 seconds timeout.
>
>I use, ping -c 1 -w 2 192.168.0.2
>
>If host is not connected, it fails correctly. BUT summary says.
>
>PING 192.168.0.2 from 192.168.0.1 : 56(84) bytes of data
>
>--------192.168.0.2 ping statastics --------
>2 packets transmitted, 0 received, 100% loss, time 999ms
>
>Why 2 packets are sent instead of 1 (specified) and why it only waits
>for 999 ms instead of 2 seconds.
>
>Even if I use: ping -c 5 -w 2 192.168.0.2, it has the same result. Here
>I wanted to send 5 packets but, again 2 packets were sent?
>
>What is wrong here? Please help me.
>Thanks a lot


There are several versions of ping, so results vary depending on
which set of bugs you encounter!

In your case, the -w option invalidates the -c option. If you
have a -w option, the -c option is ignored. That will not
likely cause you any real problems though.

The other bug is an off-by-one in the reported number of packets
sent. Again, probably not really a problem.

Offhand I would guess that both of those bugs are easy to fix,
hence if you can find out who did that version of ping it might
be possible to get something changed.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ping from C/C++ doesn't work properly using either System() or popen() Neel Linux Networking 8 02-20-2006 09:34 PM
"Ping" doesn't work properly Neel Linux Networking 1 02-14-2006 06:29 PM
Attention Plus.net Re: SPEWS DOLTS "WindsorFox", "Kevin-!:?)", "SpinDryer" SPAM broadband newsgroup !:?) Broadband 0 11-28-2005 04:28 AM
Attention Plus.Net Re: SPEWS DOLTS "WindsorFox", "Kevin-!:?)", "SpinDryer" SPAM braodband newsgroup !:?) Broadband 0 11-28-2005 03:03 AM
help me : "ping IP" works but not "ping NAME" on windows 98 2nd edition zef Windows Networking 1 08-05-2003 07:49 PM



1 2 3 4 5 6 7 8 9 10 11