- Fixing bug to prevent divide by 0 during run-time.
Fixing BUG #4 - compatibility with python 2.x [tested with 2.7]
Packet data building is different for 2.x and 3.x because of the string/bytes difference.
Fixing BUG #10 - the multiple resolv issue.
When pinging domain names instead of hosts (for example
google.com
) you can get different IP every time you try to resolve it, we should resolve the host only once and stick to that IP.Fixing BUGs #3 #10 - Doing hostname resolution only once.
Fixing BUG #14 - Removing all
global
stuff.You should not use
global
! It's bad for you...and its not thread safe!Fix - forcing the use of different times on Linux/Windows for more accurate measurements. (
time.time
for Linux andtime.clock
for Windows)Adding
quiet_ping
function - This way we'll be able to use this script as external lib.Changing default timeout to 3s. (1second is not enough)
Switching data size to packet size. It's easier for the user to ignore the fact that the packet header is 8b and the datasize 64 will make packet with size 72.
- Bugfix if host is unknown
Merge sources and create a separate GitHub repository:
https://github.com/jedie/python-ping
Add a simple CLI interface.
Bugfixes + cleanup by Jens Diemer. Tested with Ubuntu + Windows 7
Cleanup by Martin Falatic.Restored lost comments and docs. Improved functionality: constant time between pings, internal times consistently use milliseconds. Clarified annotations (e.g., in the checksum routine). Using unsigned data in IP & ICMP header pack/unpack unless otherwise necessary. Signal handling. Ping-style output formatting and stats.
Ported to py3k by Zach Ware. Mostly done by 2to3; also minor changes to
deal with bytes vs. string changes (no more ord()
in checksum()
because
source_string
is actually bytes
, added .encode()
to data in
send_one_ping()
). That's about it.
Changes by Samuel Stauffer: replaced time.clock
with default_timer
which is set to time.clock
on Windows and time.time
on other systems.
Fixes by George Notaras, reported by Chris Hallman: Improved compatibility with GNU/Linux systems.
Changes in this release:
Re-use time.time()
instead of time.clock()
. The 2007 implementation
worked only under Microsoft Windows. Failed on GNU/Linux. time.clock()
behaves differently under the two OSes:
little rewrite by Jens Diemer:
- change socket asterisk import to a normal import
- replace
time.time()
withtime.clock()
- delete
return None
(or change toreturn
only) - in
checksum()
renamestr
tosource_string
Changed the struct.pack()
calls to pack the checksum and ID as
unsigned. My thanks to Jerome Poincheval for the fix.
Initial hack. Doesn't do much, but rather than try to guess what features I (or others) will want in the future, I've only put in what I need now.
For some reason, the checksum bytes are in the wrong order when this is run under Solaris 2.X for SPARC but it works right under Linux x86. Since I don't know just what's wrong, I'll swap the bytes always and then do an htons().