[Tutor] Re: Help with ping...

lumbricus@gmx.net lumbricus@gmx.net
Fri Nov 15 11:42:01 2002


Hi!

> On Thu, Nov 14, 2002 at 12:02:20PM +0100, lumbricus@gmx.net wrote:
> 
> | [ snip ]
> | 
> | > First problem is you don't ping URLs, you ping IP addresses
> | > (either directly or via DNS)
> | 
> | Seems to work:
> | urlparse.urlparse("http://132.230.200.200")
> | ('http', '132.230.200.200', '', '', '', ''
> | 
> | Or am I missing something?
> 
> $ ping http://132.230.200.200
> ping: unknown host http://132.230.200.200

Huh?
Of course you can't give an URI to ping at the
shell. That's why the whole thing get split up 
by urlparse. And we were talking about python.

>>> uri="http://132.230.200.200" # or anything
>>> os.system("/sbin/ping %s" \   
            %urlparse.urlparse(uri)[1])
PING 132.230.200.200 (132.230.200.200): 56 data bytes
64 bytes from 132.230.200.200: icmp_seq=0 ttl=253 time=4 ms
64 bytes from 132.230.200.200: icmp_seq=1 ttl=253 time=3 ms
64 bytes from 132.230.200.200: icmp_seq=2 ttl=253 time=14 ms


----132.230.200.200 PING Statistics----
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 3/7/14 ms
2
>>> 

q.e.d?
  
> -D

Greetings, J"o!

-- 
Wir beschliessen etwas, stellen das dann in
den Raum und warten dann einige Zeit ab, was
passiert. Wenn es dann kein grosses Geschrei
gibt und keine Aufstaende, weil die meisten
gar nicht begreifen, was da beschlossen
wurde, dann machen wir weiter - Schritt fuer
Schritt, bis es kein Zurueck mehr gibt. 
   -- J-C Juncker

+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!