Name: klint Date: February 1, 2008 at 02:20:59 Pacific Subject: Using ping to provide a delay OS: Windows XP SP2 CPU/Ram: Pentium 4 Model/Manufacturer: IBM
Comment:
I tried using the ping command to provide a delay in a batch file (a similar function to the sleep.exe that comes with the Windows Resource Kit, except that ping is available on all Windows XP machines.)
PING 1.1.1.1 -n 1 -w 60000
This has been suggested in many places on the web as a way of waiting for 60 seconds. However, when I try it, it comes back immediately with the following error:
Reply from XXX: Destination host unreachable.
(where XXX is my localhost IP address.)
Any idea why this is happening on my PC and obviously is not happening on other people's, otherwise they wouldn't have suggested this technique?
(I know I can use "ping -n 61 127.0.0.1 >nul" as a workaround, but was just wondering why the above didn't work.)
My hosts file just contains 127.0.0.1 localhost and a couple of other irrelevant mappings of hostnames on our Intranet. What exactly were you thinking of, that the problem could possibly be caused by my hosts file? It's just a mapping of hostnames to ip addresses isn't it? And when you supply an IP address to ping, it don't think it even looks at the hosts file at all. Have I overlooked something?
Can you elaborate on "that's the first place it looks", as I must have misunderstood the role of the hosts file. I thought it was where it would look if you supplied a hostname, because it needs to convert it to an IP address. But if you supply a numeric IP address to begin with, what extra information does it need from the hosts file?
I don't use DHCP at work (where the ping returns immediately with the error message). I do use DHCP at home where the ping gives the required time delay. I don't have any mention of the IP address 1.1.1.1 in either hosts file. But then I don't understand how that would make any difference.
Sorry, ya you are correct. After re-reading your original post I see that. rDNS starts with your local DNS server, or ISP's DNS server, not the hosts file.
It sounds like a routing issue to me. The router could not find the network, 1.x.x.x.
klint: I thought it was where it would look if you supplied a hostname, because it needs to convert it to an IP address. You are correct. Everyone else is crazy. CRAZY, I TELL YOU! But us? We're not crazy. No, not crazy at all... (You can verify this by either watching PING.EXE's stack, or by using PROCMON.EXE.)
You'd probably gain more useful information by looking at the ROUTE PRINT command.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE