How to ping in Python?

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Wed Dec 7 11:53:16 EST 2005


Nico Grubert enlightened us with:
> I just need to "ping" a machine to see if its answering. What's the
> best way to do it?

To do a real ICMP ping, you need raw sockets, which are turned off on
Windows and reserved for root on other systems. You could try to
connect to an unused port, and see how fast a RST packet is returned.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list