[Tutor] pinging from python

Deirdre Saoirse deirdre@deirdre.net
Fri, 15 Dec 2000 12:22:15 -0800 (PST)


On Sat, 16 Dec 2000, JD, Venugopal (CORP, CIM, OMC) wrote:

> is it possible to ping to a host using python and redirect the output
> to a comma seperated value flat file.

First of all, this is a good way to make enemies -- ping *can* be used as
a hostile denial-of-service. Please don't use it this way.

Yes, there are several ways of doing this:

1) On Unix, you can redirect the status of an external command -- see the
commands module.

2) You can re-write the c-based "ping" program in python. Source code for
ping is available in numerous places, including with most Linux
distributions.

-- 
_Deirdre      *      http://www.sfknit.org      *      http://www.deirdre.net
"Our society has not yet gone so far as to place blind faith in machines. In 
almost all endeavors, humans routinely correct the errors of machines."
                                                     - Florida Supreme Court