Page 1 of 1

Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 05:25
by alan_b
I have achieved Infinitesimally adjustable PING delay via

Code: Select all

ping -w %1 128.0.0.1 -n 1 > NUL


Is 128.0.0.1 always good for getting a "Request timed out." response from ping so that the -w option will control the delay ?

Supplementary question :-

Why is -w always wrong ?
Can I fix it somehow, perhaps in the registry ?
I find the actual delay achieved is 500 mSec more than I ask for,
e.g. the argument has to be 9500 if I really want 10000 mSec,
and an argument of 100 gives me 500 mSec.

I find a delay of only 200 mSec when I use
ping -w %1 127.0.0.1 -n 1

If I could fix this offset I should be able to control down to 200 mSec instead of 500 mSec.
My only option below 500 mSec seem to be
390 mSec via "PING Google.net -n 1 > NUL"
or something a bit smaller if I aim at a site that is not across the Atlantic.

Alan

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 08:18
by aGerman
Hello Alan.

As far as I know 128.0.0.1 belongs to class B IP adresses and could be an guilty internet address. It's administered by ARIN (American Registry for Internet Numbers), you could ask them (just kidding :wink:).
But finaly it's a good question. I often use 0.0.0.0 because I know it's a reserved IP address ...


The reason why you have an additional delay of 200...500 ms is that ping is no internal function of cmd.exe. By calling ping your computer has to create a ping.exe process. It depends on the speed of your machine and on the current CPU use how much time it wastes. For me it's 150...250 ms.
Maybe it's a question of priority as well. Try something like
START /HIGH /WAIT /B PING ...
to find out.

Regards
aGerman

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 09:26
by amel27
Hi All.

128.0.0.0/24 is Netherlands address pool. According to RFC 3330 we can use for this purposes two pools:
192.0.2.0/24 - This block is assigned as "TEST-NET" for use in documentation and example code. It is often used in conjunction with domain names example.com or example.net in vendor and protocol documentation. Addresses within this block should not appear on the public Internet.

198.18.0.0/15 - This block has been allocated for use in benchmark tests of network interconnect devices. Its use is documented in [RFC2544].

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 09:39
by aGerman
Thanks for this information, amel27. I was never searching for it since 0.0.0.0 worked for me.

Regards
aGerman

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 12:31
by alan_b
aGerman wrote:I often use 0.0.0.0 because I know it's a reserved IP address ...
aGerman

Unfortunately the -w option is ignored and the immediate response is
"Destination specified is invalid."

aGerman wrote:By calling ping your computer has to create a ping.exe process.
aGerman

Comodo "Defense+" shows me that CMD.EXE invokes Windows\System32\Ping.exe,
and this is an ancient external command.
When you said "create a ping.exe process" were you referring to what I think I remember as "Building the IP stack" ?

aGerman wrote:Maybe it's a question of priority as well. Try something like
START /HIGH /WAIT /B PING ...
aGerman

Thanks, that does slightly reduce the excess when not much else is happening,
and will probably give me much faster and more reproducible results when website adverts push the Firefox CPU usage to 90%.

amel27 wrote:128.0.0.0/24 is Netherlands address pool.

Thanks for the information.
I would not want to inadvertently launch a PING and distract a Dutchman from sticking his finger in the sea defenses ! ! !

amel27 wrote:192.0.2.0/24 - This block is assigned as "TEST-NET"

I am now using 192.0.2.0

Regards and thanks to all
Alan

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 13:56
by aGerman
alan_b wrote:When you said "create a ping.exe process" were you referring to what I think I remember as "Building the IP stack" ?


No, that's not the same. It takes exactly the same time to call each other external command/tool. I think if ping.exe is running then building the IP stack will need less than a ms.

Regards
aGerman

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 15:18
by alan_b
Thanks

I was surprised it takes so long for the executable to be launched.

I thought it might take a while visiting folders on the %PATH%,
but found it took just as long if I replaced PING with
C:\WINDOWS\system32\PING.EXE.

I had not realized that launching an exe takes so much longer than the rotational latency of my HDD.

Regards
Alan

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 22 Jan 2011 16:03
by aGerman
Hmm, using the full name is probably helpful if you have a lot of files in the current working directory. This is the place where cmd is searching first.
Usually the first directory in %path% is C:\Windows\System32, where cmd is searching next. Thats why it will not make a significant difference.

Regards
aGerman

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 23 Jan 2011 03:22
by alan_b
It reminds me of my first P.C. with DOS 3.?

A very simple script took quite a time if it had a loop.
Then I copied it from the HDD to 5.25" floppy and ran from the floppy.
I could feel its pain as it clattered through the whole file reading it one line at a time until it got to the line just executed so it could then read and execute the next line ! !
I cannot now remember whether the script was a DOS batch file or a Dartmouth Basic interpreter program.

Fortunately I had the luxury of one Megabyte of RAM and Bill Gates decreed that anything more that 640 KB was wasted, so I included a RAM disk driver and at startup I copied all by scripts to the 360 KB RAM disk. That system flew.

Why do a succession of PINGs in my script each take so long to launch and do nothing ?
I thought XP had a cache in RAM that should remember what was loaded the first time,
and then repeat without clattering through the disk every time ! ! !

So glad I do not have UAC as well.

Regards
Alan

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 23 Jan 2011 04:29
by amel27
alan_b wrote:I thought XP had a cache in RAM that should remember what was loaded the first time, and then repeat without clattering through the disk every time ! ! !
Yes, XP have cache, but Windows dinamically operates its content. AFAIK impossible manually control individual file caching.

Caching whole BAT file will make impossible Self Modification feature. Otherwise, FOR loop cached whole block code between parentheses.

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 23 Jan 2011 11:22
by alan_b
amel27 wrote:Caching whole BAT file will make impossible Self Modification feature. Otherwise, FOR loop cached whole block code between parentheses.


Oh dear, the more you tell me the less I know ! ! !

Typically I may end a script with PAUSE so I can see the results when launched by double clicking,
and if it crashes and never gets to PAUSE,
then I run CMD.EXE and use the CLI to run the script to see what it was doing when it crashed.
Then I edit to fix things and try again.
Once it sort of works I may fix it some more.

Bitter experience - If it stops at PAUSE and I fail to UN-Pause when I edit,
when I finish EDIT and try to run again, as soon as I UN-Pause then chaos breaks out, which I assume is because PAUSE was at file byte no. 1234 and I have now inserted an extra 100 bytes and UN-Pause now continues from 1235 instead of 1335.

Also with pre-XP using Command.com it always crashed when I tried to make the script self-modify.
The closest I ever got was for the script to copy itself with a different name,
and to append an extra line of code to the copy for future use.

I would appreciate a link to an example of successful self modifying batch code.

Regards
Alan

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 23 Jan 2011 11:51
by aGerman

Re: Adjustable PING delay. Is 128.0.0.1 always good ?

Posted: 23 Jan 2011 13:19
by alan_b
Thanks for that link.

Sometimes I am too ambitious with my scripts and I have to debug them.
I have now realized that anything self-modifying will be complex and need a lot of debugging,
and trying to debug what changes of its own accord will damage my sanity.

Regards
Alan