Design idea for Ping Application

Mike C. Fletcher mcfletch at rogers.com
Tue Aug 19 12:58:57 CEST 2003


Jeremy Hylton wrote:
...

>Years ago I wrote ping in Python.  I don't have the code anymore, but
>there's not too much too it.  One of the Stevens books has C source for
>a simple ping, and it's not much work to adapt the basic design to
>Python.  It's far simpler than the C code.
>
>If you had a simple ping library in Python, it would be easy to run
>several Ping instances in a single select loop.  Then you don't need to
>bother with threads and pipes and shells.
>  
>
As pointed out by a previous poster, it's available from Python.org.  
We've got  a version which fixes a few (trivial) bugs (use of 'h' 
instead of 'H' in struct formats mostly, to indicate unsigned rather 
than signed ints).  Works nicely on Win32, however, I've not yet been 
able to get the code to run under Unix (where creating raw sockets is a 
no-no).

Our particular usage for it is (similar to the OP) as a component in a 
network monitoring application where fallback cases want to check a few 
hundred or thousand hosts on a local network to see if failures are 
occuring at the transport level or something higher.  We use a custom 
asynchronous loop to keep ~ 100 requests in play simultaneously w/out 
any threading or process-spawning at all.

Would love to hear from anyone who's doing ping on Unix and getting 
around the raw-socket restriction...

It's alive!  It's alive!
Mike

BTW, if people care (and Jeremy's okay with it), I'd be happy to package 
up Jeremy's tar in a disutils package (with bug-fixes) and create a 
sourceforge project for it (in my ever so copious free time :) ) so the 
code can continue to live a happy and productive life.

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/








More information about the Python-list mailing list