I need simple ping that will return some float number or None if destination unreachable. I am using Python 3 and windows and don't want to use standart ping, cause i have to decode bytes from shell and parse results. I know nothing about implementation of ICMP protocol so ready to use library is the best choice.
Asked
Active
Viewed 1.7k times
2 Answers
7
You could use a pure Python implementation like the following:
https://pypi.python.org/pypi/ping
or if you prefer this one:
http://www.python.org/~jeremy/python.html
and also take a look here, because they are discussing about the subject and you may find it useful:
UPDATE
Without the need of patching for Py 3, a very simple example:
-
First says that code is for python 2, the second says that code was written for python 1.4. – m9_psy Nov 11 '13 at 07:40
-
@m9_psy Yes, I know that but they can be modified to work with 3.x. I'm unaware of any implementation in 3.x, but it should serve as an example of how to do it. – asalic Nov 11 '13 at 07:43
2
Active State Recipes is always the first place when I want to find such tiny/common/useful code snippets.
Here's one:
It works in Python3,

Leonardo.Z
- 9,425
- 3
- 35
- 38