How to ping in Python?
Laszlo Zsolt Nagy
gandalf at designaproduct.biz
Wed Dec 7 07:22:10 CET 2005
Michael Schneider wrote:
>I telnet to port 13 (returns time)
The problem is that most modern up-to-date servers use firewalls. They
only open the ports that are absolutely necessary. Usually the time
service is part of inetd, which is disabled by default, on most of the
servers. PING ICMP may work, but sometimes it does not either. In the
worst case, all port are closed and you have no way to tell if there is
a computer or not.
Can you tell more about what kind of server do you need to "ping"?
Example: if you need to know if a web server is alive, you should
connect to port 80 (http). If the connection was successful, you can
close the connection immeditelly. You can expect a HTTP server to open
the HTTP port, but all other ports may be closed.
More information about the Python-list