Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Using ping to provide a delay

Original Message
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.)


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: February 1, 2008 at 05:17:10 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
check your HOSTS file



=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 2
Name: Razor2.3
Date: February 1, 2008 at 06:29:47 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
See, this is why I prefer to make a sleep.vbs.

Report Offensive Follow Up For Removal

Response Number 3
Name: tonysathre
Date: February 1, 2008 at 14:54:15 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
"check your HOSTS file"

I second that.


Report Offensive Follow Up For Removal

Response Number 4
Name: klint
Date: February 1, 2008 at 15:22:07 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
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?

Report Offensive Follow Up For Removal

Response Number 5
Name: tonysathre
Date: February 1, 2008 at 15:46:19 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
"And when you supply an IP address to ping, it don't think it even looks at the hosts file at all"

Actually, that's the first place it looks.

Are you using DHCP on your LAN? If you're not, I would suggest adding whatever static IP you have set to your HOSTS file, pointing it at localhost.


Report Offensive Follow Up For Removal


Response Number 6
Name: klint
Date: February 1, 2008 at 17:39:29 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
Tony,

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.


Report Offensive Follow Up For Removal

Response Number 7
Name: tonysathre
Date: February 1, 2008 at 18:31:47 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 8
Name: Razor2.3
Date: February 1, 2008 at 18:32:20 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
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.

EDIT: VVV He admits! CRAZY! VVV


Report Offensive Follow Up For Removal

Response Number 9
Name: tonysathre
Date: February 1, 2008 at 18:43:17 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
"Everyone else is crazy"

I'm not that crazy, just wrong on occasion. Lol


Report Offensive Follow Up For Removal

Response Number 10
Name: klint
Date: February 3, 2008 at 05:32:56 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
Thanks, I'm not a networking expert but the ROUTE command you suggest seems worth trying. I'll need to spend some time to understand it.

Report Offensive Follow Up For Removal

Response Number 11
Name: Razor2.3
Date: February 3, 2008 at 10:22:34 Pacific
Subject: Using ping to provide a delay
Reply: (edit)
For reference, here's what a generic Windows route table looks like:
Sun 02/03/2008 13:20:32.26
E:\Documents and Settings>route print

===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 0c 41 64 70 96 ...... Wireless-G PCI Adapter - Packet Scheduler Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.5 25
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.1.0 255.255.255.0 192.168.1.5 192.168.1.5 25
192.168.1.5 255.255.255.255 127.0.0.1 127.0.0.1 25
192.168.1.255 255.255.255.255 192.168.1.5 192.168.1.5 25
224.0.0.0 240.0.0.0 192.168.1.5 192.168.1.5 25
255.255.255.255 255.255.255.255 192.168.1.5 192.168.1.5 1
Default Gateway: 192.168.1.1
===========================================================================
Persistent Routes:
None


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Using ping to provide a delay

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




how to setup call of duty to joytok

WindowsME / HotMail Problem

Corrupt memory

Convert fat32 to Ntfs

Best WinMo phone of 2008


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

All content ©1996-2007 Computing.Net, LLC