[Tutor] pinging from python
Darrell Brogdon
dbrogdon@valinux.com
Fri, 22 Dec 2000 10:44:52 -0500
For future reference:
fp = os.popen('ping -c 4 yahoo.com')
ping_results = fp.read()
I'm not sure how to explicitly close this connection yet (see the
"valueOf() equivalent" thread)
Deirdre Saoirse wrote:
> 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.
>
--
Darrell Brogdon http://darrell.brogdon.net
Web Developer - SourceForge http://sourceforge.net
VA Linux Systems, Inc. http://www.valinux.com