Registry / http-networking / multiping

multiping

JSON →
library1.1.2pypypi✓ verified 84d ago

The `multiping` library is a pure Python implementation for sending and receiving ICMP echo requests (ping) to monitor IP addresses. It allows for concurrent pinging of multiple hosts, providing response times and identifying unreachable hosts. The current version is 1.1.2. Releases are infrequent but address compatibility and bug fixes, indicating a stable, low-maintenance project.

pip install multiping
INSTALL
IMPORT
SIG · MULTIPING
M
multiping
http-networkingpythonv1.1.2
Install
1.6s avg
Import
9ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.009s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MultiPing
from multiping import MultiPing

This quickstart demonstrates how to initialize `MultiPing` with a list of hosts, send ICMP echo requests, and then receive responses within a specified timeout. It handles common `PermissionError` that arises from sending raw ICMP packets.

from multiping import MultiPing import time # List of hosts to ping hosts = ['127.0.0.1', 'google.com', 'nonexistent.domain', '8.8.8.8'] try: # Create a MultiPing instance with a list of hosts # Optionally specify a port (defaults to 1 for ICMP) and IPv6 (False by default) mp = MultiPing(hosts, timeout=1, retry=1, verbose=False) # Send the ICMP echo requests # This sends packets in a non-blocking way mp.send() # Wait for responses for up to 1 second # receive() returns responses, and a list of hosts that did not respond within the timeout responses, no_responses = mp.receive(1.0) print("--- Ping Results ---") for addr, rtt in responses.items(): print(f"Host: {addr}, RTT: {rtt*1000:.2f} ms") if no_responses: print("\n--- No Response From ---") for addr in no_responses: print(f"Host: {addr}") except PermissionError: print("Error: Permission denied. Running ping often requires root/administrator privileges.") print("Try running with 'sudo python your_script.py' or as an administrator on Windows.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
gotchaSending raw ICMP packets often requires elevated privileges (root on Linux/macOS, administrator on Windows). Without them, you will likely encounter `PermissionError` or `OSError: [Errno 1] Operation not permitted`.
fix
Run your Python script with `sudo python your_script.py` on Linux/macOS, or as an administrator on Windows. Alternatively, consider using `setcap` on Linux to grant CAP_NET_RAW capability to your Python executable if appropriate for your security model.
affects: All versions
gotchaThe `receive()` method blocks for the specified timeout, collecting responses. If the timeout is too short, you might miss late responses. If it's too long, your program might wait unnecessarily.
fix
Choose an appropriate timeout value for `mp.receive(timeout_seconds)` based on your network conditions and requirements. A typical starting point is 0.5 to 1.0 seconds for general internet hosts.
affects: All versions
gotchaResolving hostnames (e.g., 'google.com') occurs synchronously when `MultiPing` is initialized. If you have many hostnames or slow DNS servers, this can delay the start of pinging. Unresolvable hostnames will lead to them being silently dropped from the list of hosts to ping.
fix
For critical applications or a large number of hosts, pre-resolve hostnames to IP addresses using `socket.gethostbyname()` or similar functions before passing them to `MultiPing`. Handle DNS resolution errors explicitly if required.
affects: All versions
Errors
Common errors & fixes
OSError: [Errno 1] Operation not permitted
The Python process does not have the necessary permissions to create raw sockets required for sending ICMP packets.
fix
Run the script with elevated privileges: `sudo python your_script.py` on Linux/macOS, or as an administrator on Windows. Ensure no firewall is blocking outbound ICMP traffic.
socket.error: [Errno 1] Operation not permitted
Same as `OSError`, indicates insufficient permissions to perform raw socket operations.
fix
Run the script with elevated privileges: `sudo python your_script.py` on Linux/macOS, or as an administrator on Windows. Check firewall rules.
ModuleNotFoundError: No module named 'multiping'
The `multiping` library has not been installed in the current Python environment, or the environment is not active.
fix
Install the library using pip: `pip install multiping`. If using a virtual environment, ensure it is activated before installation and execution.
Upgrade
Version history
1.1.2latest on PyPI · released May 24, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
2
Resources
multiping — pip install multiping · libregistry