[Twisted-Python] Support for ICMP ping?

Jean-Paul Calderone exarkun at divmod.com
Mon Sep 11 22:42:13 EDT 2006

On Tue, 12 Sep 2006 11:42:49 +1000, Michael Samuel <michael at miknet.net> wrote:
>On a similar note, I've been looking to implement OSPF in twisted (which
>does multicast over IP protocol 89), and was wondering the best way to
>bludgeon DatagramSocket into doing raw IP. (Preferably in a
>cross-platform manner, but if it only works on Linux it'd suit my
>purposes fine)  Any hints?

You can't and shouldn't co-opt DatagramSocket for this.  Instead, add a new kind of transport, a raw socket.  This should be fairly straightforward and it would actually be a fairly useful addition to Twisted.

>BTW, is there any interest in BGP around here?  I've implemented it as a
>research project for work, and they've given me the go ahead to release
>the source.

It'd be neat.  I can't think of anything I'd personally be able to _do_
with it. :)

>Oh, and to answer the original question... take a look at fping.  It's
>output is designed to be parsed, and it scales really well.

I'll second this recommendation.  You need root privileges on most systems
to open an ICMPable socket anyway.  Running your whole process as root just
so you can ping some stuff is kind of unfortunate.


More information about the Twisted-Python mailing list