[Tutor] How to ping

lumbricus@gmx.net lumbricus@gmx.net
Sun, 23 Jun 2002 13:41:27 +0200 (MEST)


> On Sun, Jun 23, 2002 at 12:24:53PM +1000, Dimitrije Nikic wrote:
> > Hey people,
> > How do you ping an IP address and then assign the ping to a 
>> variable?

What do you mean with "the ping"
The output of the ping command is implementation dependend.
You may want to parse it.

> > Thx for your help...
> 
> You could try doing my_var = commands.getoutput("ping ip")

use the socket module  
And send an IPPROTO_ICMP packet with ECHO_REPLY set.

>  - Andrei

HTH,HAND
and Greetings, J"o!


-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net