TELNET instead PING

DCK dck at gazeta.pl
Tue Jan 27 06:11:22 EST 2004


Peter Hansen wrote:
> Interesting, but why would you use TELNET for that?  Telnet is
> simply one of many possible protocols, whereas you need only
> open a socket to the port to see if the host is responding.
I was on some kind of Network course, where teacher said, that telnet
is better then PING. In my work i found this usefull for pinging
network. When i meet with Python, i foud TELNETLIB module and write
simply scheduled script which probe network.

> from socket import *
> s = socket(AF_INET, SOCK_STREAM)
> try:
>     s.connect((host, port))
>     print 'host connected'
>     s.close()
> except error:
>     print 'host not responding'

THX for this advice. In future i will read manual carefully :)

Greetz
Michal DCK Kaczor



More information about the Python-list mailing list