You are not logged in.

#1 01 May 2014 08:13

carlos
Member
From: Chile
Registered: 04 Nov 2008
Posts: 251
Website

For http://ss64.com/nt/ping.html

Hello. Maybe this can appear in http://ss64.com/nt/ping.html

I get this info time ago, and can be useful.

The default values for ping are:
-l 32
-w 4000

Currently. it says "default time period of one second." but are 4 seconds.

And a update or improve for the sleep trick using ping. Current it uses PING -n 31 127.0.0.1>nul but it not very exact. For example: -n 2 can consume 1 second.

For get the sleep trick using the ping, we need specify the timeout request in milliseconds using the option -w.
For consume the timeout we need specify a ip that will not response. Other than 127.0.0.1 (because this always response, even without any network card ).
What ip can use?
In windows xp the first valid ip is 0.0.0.0, but on windows 8 it is not considered valid (message: "PING: transmit failed. General failure."). Windows 8 accept as first valid ip: 1.0.0.0 (message: "Request timed out."). Using the ip 1.0.0.0 we ensure that ip will not response, and ping will wait the timeout.

Then, for compatibility with windows xp and windows 8, we can get the sleep effect using ping using this:

for 3 seconds (3*1000) = 3000 milliseconds

ping -l 0 -n 1 -w 3000 1.0.0.0 >nul

That means echo 1 request ping to server 1.0.0.0 with a buffer of size 0 and use a timeout of 3000 milliseconds (3 seconds).

Last edited by carlos (01 May 2014 08:16)

Offline

#2 01 May 2014 23:52

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: For http://ss64.com/nt/ping.html

"1.0.0.0/8 has been assigned by IANA to APNIC on the 19th January 2010, for use for as public unicast space for further address allocations and assignments."
see
http://www.potaroo.net/studies/1slash8/1slash8.html

So I'm not sure that it's safe to use IP addresses other than the loopback address, even if you find an address that seems fine now it could change in a few years.

Anyway, I have updated the page with a few changes including the correct defaults, thanks for the info.
The 1 second thing is not a timeout but the delay between pings, this is why 3 pings gives a delay of 2 seconds.

Simon

Offline

#3 02 May 2014 14:01

carlos
Member
From: Chile
Registered: 04 Nov 2008
Posts: 251
Website

Re: For http://ss64.com/nt/ping.html

Thanks Simon.
Is interesting for me read about that IP range.

Offline

#4 02 May 2014 15:14

einstein1969
Member
From: Italy
Registered: 29 Dec 2013
Posts: 25

Re: For http://ss64.com/nt/ping.html

Hi,

Regard the sleep use of ping, I thinks that the only IP's that is not preposed for Wan or Lan are the Ip's of special uses. The Ip for the TEST-NET* not are used in Wan or Lan and might be an option.

The blocks 192.0.2.0/24 (TEST-NET-1), 198.51.100.0/24 (TEST-NET-2),
   and 203.0.113.0/24 (TEST-NET-3) are provided for use in
   documentation.

I use for example the classical 192.0.2.0 for Ping -w how sleep/delay/wait

Ref: rfc5737

einstein1969

Offline

#5 02 May 2014 20:51

carlos
Member
From: Chile
Registered: 04 Nov 2008
Posts: 251
Website

Re: For http://ss64.com/nt/ping.html

good info einstein1969. Thanks.

But i think that is better 203.0.113.0 because looks like a public ip but not used as public ip.
But, for avoid suspect of ping to public ip, the ip that you use ( 192.0.2.0 ) looks better.

Then, the sleep effect can be considered safe using:

ping -l 0 -n 1 -w 3000 192.0.2.0 >nul

Last edited by carlos (02 May 2014 21:02)

Offline

#6 10 May 2014 23:25

einstein1969
Member
From: Italy
Registered: 29 Dec 2013
Posts: 25

Re: For http://ss64.com/nt/ping.html

If the variable:

SystemRoot=C:\Windows

is not defined , the ping report incomplete/dirty information:

>ping 127.0.0.1 -n 3

Esecuzione di Ping  con 32 byte di dati:
Risposta da 127.0.0.1: byte=32 durata<1ms TTL=128
Risposta da 127.0.0.1: byte=32 durata<1ms TTL=128
Risposta da 127.0.0.1: byte=32 durata<1ms TTL=128

Statistiche Ping per uö,¯þÿÿÿ(õ%:
    Pacchetti: Trasmessi = 3, Ricevuti = 3,
    Persi = 0 (0% persi),
Tempo approssimativo percorsi andata/ritorno in millisecondi:
    Minimo = 0ms, Massimo =  0ms, Medio =  0ms

on Windows 7 32bit
einstein1969

Last edited by einstein1969 (10 May 2014 23:26)

Offline

#7 14 May 2014 18:53

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: For http://ss64.com/nt/ping.html

^ Thats a strange bug, running repeated pings, the corrupted text is (usually) different for each run:

Instead of "Ping statistics for  127.0.0.1"

Ping statistics for °z↓:
Ping statistics for °-9:
Ping statistics for  h0:

Attempting to ping a remote machine or website fails completely if %systemroot% is undefined

Offline

#8 15 Aug 2014 18:17

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: For http://ss64.com/nt/ping.html

einstein1969 wrote:

Hi,

Regard the sleep use of ping, I thinks that the only IP's that is not preposed for Wan or Lan are the Ip's of special uses. The Ip for the TEST-NET* not are used in Wan or Lan and might be an option.
The blocks 192.0.2.0

einstein1969

The problem I see with this is that the behaviour of a test net IP address is undefined, it is allocated "for use in documentation and example code." using PING to generate a delay may be unconventional but it is still a valid use of the network, so I think the most appropriate address to use is the loopback adapter.

Offline

Board footer

Powered by