Trivia question: max value for -w in ping command?

MilesAhead

Eclectician
VIP Member
Pro User
Messages
2,130
Trivia question: max value for -w in ping command? I don't mean the max wait a ping can experience. I just mean the maximum value after -w on the command line that will not give an error. If they use a 32 bit integer then it's pretty big. But if it's only 16 bit maybe we're limited to 64k?

ping 127.0.0.1 -n 2 -w 50000 > nul
--------------------------^^^^


edit: I haven't found an answer on bing so I'm just curious if anyone knows. :)

edit2: for the purpose of this trivia let's limit it to W8 command line .. not Linux or OS/2 or whatever.
 

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad
I'm not entirely sure what the maximum is but what I believe you are trying to do is to set a wait period in a batch file?

For a wait out period I set the timeout period to 1000 (1 Second) and then use the count trigger to determine the amount of seconds to wait.

For example:

ping 127.0.0.1 -n 300 -w 1000 >nul

I set this command to wait 1 second between each ping and then repeat that 300 times. 300 Seconds = 5 minutes

Just a thought, I'll try and see if there is a maximum value...

EDIT: Just found out that the timeout switch will only come into effect if a ping destination is not reachable. Since a loopback address will always respond the timeout will not take effect. Try to ping a destination address that does not exist and it will. For example, sending a ping to 172.16.0.1 should fail since it is a private IP address and chances are that you will not have one on a home network. The timeout between each ping will then take affect. As a test I decided to try a timeout of a massive number and appears to be working so I am not entirely sure of the max value:

ping.png

Now that I know this I am going to change some scripts I had to allow the 1 second timeout between each ping... :eek:

Josh :)
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1 Pro 64-bit ; Windows Server 2012 R2 Standard
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom Built
    CPU
    Intel Core i5 2400 @ 3.10GHz
    Motherboard
    Foxconn H67MP-S/-V/H67MP (CPU 1)
    Memory
    8.0GB DDR3 @ 665MHz (2GBx4)
    Graphics Card(s)
    AMD Radeon HD 6800 Series (Sapphire/PCPartner)
    Sound Card
    Realtek High Definition Audio
    Monitor(s) Displays
    SMB1930NW + AOC 2243W
    Screen Resolution
    1440x900 + 1920x1080
    Hard Drives
    977GB Seagate ST31000524AS ATA Device (SATA)
    250GB WD iSCSI attached drive
    PSU
    750W PSU
    Case
    Novatech Night
    Keyboard
    Dell Standard PS/2 Keyboard
    Mouse
    R.A.T 7 Gaming Mouse
    Browser
    Google Chrome
    Other Info
    Optiarc DVD RW AD-5260S ATA Device
I should have used the line from a post that made me ask this question instead of the localhost address
ping 192.0.2.2 -n 1 -w 60000 > nul

(the page example used only 6000 for six seconds per 'n' : I made it 60000)

According to the page where I found this line that address is supposedly defined as unreachable by standard.

I used such a high number of milliseconds because the user wanted a delay of minutes. I figured if I made the number after -n equal to minutes it would be easier to understand.

I'm just curious what the threshold of ms is. I suspect it's at least 32 bit signed integer but you never know with command line legacy code. I'm glad I searched on it because I was using ping for seconds delay with the 127 address too in my batches. :)
 

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad
192.0.2.2 would be a public IP address so someone may have it on the internet or it may not be used. I don't know...

I have decided to use an autoconfiguration address that is only used when a device cannot get a DHCP offer (169.254.xxx.xxx)

Either way, as long as it offers a timeout the parameters should be met

Josh :)
 

My Computer

System One

  • OS
    Windows 8.1 Pro 64-bit ; Windows Server 2012 R2 Standard
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom Built
    CPU
    Intel Core i5 2400 @ 3.10GHz
    Motherboard
    Foxconn H67MP-S/-V/H67MP (CPU 1)
    Memory
    8.0GB DDR3 @ 665MHz (2GBx4)
    Graphics Card(s)
    AMD Radeon HD 6800 Series (Sapphire/PCPartner)
    Sound Card
    Realtek High Definition Audio
    Monitor(s) Displays
    SMB1930NW + AOC 2243W
    Screen Resolution
    1440x900 + 1920x1080
    Hard Drives
    977GB Seagate ST31000524AS ATA Device (SATA)
    250GB WD iSCSI attached drive
    PSU
    750W PSU
    Case
    Novatech Night
    Keyboard
    Dell Standard PS/2 Keyboard
    Mouse
    R.A.T 7 Gaming Mouse
    Browser
    Google Chrome
    Other Info
    Optiarc DVD RW AD-5260S ATA Device

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad
Hmmm... I didn't know that! Cheers for the link :)
 

My Computer

System One

  • OS
    Windows 8.1 Pro 64-bit ; Windows Server 2012 R2 Standard
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom Built
    CPU
    Intel Core i5 2400 @ 3.10GHz
    Motherboard
    Foxconn H67MP-S/-V/H67MP (CPU 1)
    Memory
    8.0GB DDR3 @ 665MHz (2GBx4)
    Graphics Card(s)
    AMD Radeon HD 6800 Series (Sapphire/PCPartner)
    Sound Card
    Realtek High Definition Audio
    Monitor(s) Displays
    SMB1930NW + AOC 2243W
    Screen Resolution
    1440x900 + 1920x1080
    Hard Drives
    977GB Seagate ST31000524AS ATA Device (SATA)
    250GB WD iSCSI attached drive
    PSU
    750W PSU
    Case
    Novatech Night
    Keyboard
    Dell Standard PS/2 Keyboard
    Mouse
    R.A.T 7 Gaming Mouse
    Browser
    Google Chrome
    Other Info
    Optiarc DVD RW AD-5260S ATA Device
I didn't actually look at the RFC. I took his word for it. :)
 

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad
Back
Top