Skip to main content

winping

Ping implementation which utilizes Windows ICMP API


:heart: :heart: :heart:

You can say thanks to the author by donations to these wallets:

  • ETH: 0xB71250010e8beC90C5f9ddF408251eBA9dD7320e
  • BTC:
    • Legacy: 1N89PRvG1CSsUk9sxKwBwudN6TjTPQ1N8a
    • Segwit: bc1qc0hcyxc000qf0ketv4r44ld7dlgmmu73rtlntw

Installation

Standard Python package installation.

Usage

Utility

Synopsis

C:\>winping --help
usage: winping [-h] [-w TIMEOUT] [-l SIZE] [-t | -n COUNT] [-4 | -6] address

Ping implementation which utilizes Windows ICMP API

positional arguments:
  address     specifies the host name or IP address of the destination

optional arguments:
  -h, --help  show this help message and exit
  -w TIMEOUT  timeout in milliseconds to wait for each reply (default: 1000)
  -l SIZE     number of data bytes to be sent (default: 32)
  -t          ping the specified host until stopped (default: False)
  -n COUNT    number of echo requests to send (default: 4)
  -4          force using IPv4 (default: False)
  -6          force using IPv6 (default: False)

Example

C:\>winping google.com

Pinging google.com [172.217.20.206] with 32 bytes of data:
Reply from 172.217.20.206: bytes=32 time=29ms TTL=57
Reply from 172.217.20.206: bytes=32 time=25ms TTL=57
Reply from 172.217.20.206: bytes=32 time=24ms TTL=57
Reply from 172.217.20.206: bytes=32 time=25ms TTL=57

Ping statistics for 172.217.20.206:
    Packets: Sent = 4, Received = 4, Lost = 0 (0.00% loss),
Approximate round trip times in milli-seconds:
    Minimum = 24ms, Maximum = 29ms, Average = 26ms

C:\>winping -6 google.com

Pinging google.com [2a00:1450:401b:804::200e] with 32 bytes of data:
Reply from 2a00:1450:401b:804::200e: time=79ms
Reply from 2a00:1450:401b:804::200e: time=77ms
Reply from 2a00:1450:401b:804::200e: time=76ms
Reply from 2a00:1450:401b:804::200e: time=75ms

Ping statistics for 2a00:1450:401b:804::200e:
    Packets: Sent = 4, Received = 4, Lost = 0 (0.00% loss),
Approximate round trip times in milli-seconds:
    Minimum = 75ms, Maximum = 79ms, Average = 77ms

Also, if python scripts are not in your system path, you may run it like this: python -m winping

Library

import winping
with winping.IcmpHandle() as h:
    resp = winping.ping(h, '8.8.8.8')
print(resp[0].RoundTripTime)
with winping.Icmp6Handle() as h:
    resp = winping.ping6(h, '2a00:1450:401b:804::200e')
print(resp[0].RoundTripTime)

For example of working ping utility see winping/__main__.py.

Limitations

  • Works only on Windows XP / Windows Server 2003 and newer.
  • No asyncio support at this moment, but you may run ping in thread executor.

Release files for winping 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for winping 0.2.4
File Size Uploaded
winping-0.2.4.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for winping 0.2.4
File Interpreter ABI Platform
winping-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / winping-0.2.4.tar.gz

Download URL winping-0.2.4.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
428fe29fed98e869ec7d98333ed9e56e0cd83885113ec518b6acc46a6511363b
BLAKE2b-256 checksum
How to use checksums
8fc8693c6747233b2ded1bd7cf6c85d66cc252fd7218b2f0b3020aea85a43672
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4

Release files / winping-0.2.4-py3-none-any.whl

Download URL winping-0.2.4-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d03716eb74de8d41a1354a6396c0c18ad211e56b7a4cb5733c45ed9464d5a224
BLAKE2b-256 checksum
How to use checksums
268bb2eceaeeb937666d18e6908f4b3a6097fde5078b4d9937a9809ee05f41c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page