RSS icon Home icon
  • High resolution ping for Windows

    Posted on December 30th, 2014 admin No comments

    This little tool can generate sub-millisecond precision ICMP Echo messages. The interval between consecutive packets, the results or the waiting timeout are all in microseconds. The main idea behind this tool is the ICMP packets should be sent at constant interval so waiting for an outsanding message won’t block further messages. For instance, you cannot set packet interval in Windows’ internal ping.exe. Only members of the Administrators group can use this tool since it uses a raw socket. After a successful run the min/max/avg and stdev round trip times are calculated.

    This tool is successfully tested on Windows XP and Windows 7 machines. You can download the binary here.

    The full source code can be downloaded here. It’s for Delphi or Free Pascal compilers. The HresPing.pas unit can be used in other projects. Successfully tested in Free Pascal 2.6.4 and Delphi 6.

    One known issue: Using this tool on Windows 7 and ZoneAlarm’s firewall installed may cause a BSOD (Blue Screen Of Death) with DRIVER_IRQL_NOT_LESS_OR_EQUAL error code. In this particular case the vsdatant.sys (TrueVector Device Driver) generates the system halt. This driver is also part of Check Point Endpoint VPN client. It caused BSOD even if firewall is turned off in the VPN client. I didn’t found a solution yet. But you can found so many complaints about vsdatant.sys problems on the internet.

    So how this HresPing works…

    It is based on a RAW socket and two independent threads. One thread for sending ICMP Echoes and one for receiving replies. This way sending won’t be blocked. The sub-millisecond accuracy is achieved by the help of QueryPerfmanceCoutner calls. The accuracy depends on the actual hardware/software environment. The sender loop actively waits for the given interval to elapse before sending another ICMP Echo. The receiver thread silently waits for READ socket events and reads new packets. The receiver thread waits for the sender to be done and cleans up. Every packet have a sent and read-out timestamp to calculate the RTT. The RAW socket type is required to generate ICMP messages.

    The ICMP Echo identifier field is filled with the process id. The sequence number is only a 16 bit field which limits to 65536 messages. I may modify it to handle unlimited message count by enabling sequence number wrap-around and/or extending the counter to 32 bit by using the identifier field.

    This library can be easily ported to C/C++. I may translate it if I’ll have time…

     

    Leave a Reply

    Your email address will not be published. Required fields are marked *