usr bin env python import socket select try sock socket socket socket

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#!/usr/bin/env python
import socket, select
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect( ('www.linux.kiev.ua', 80) )
print "connect"
res = select.select( [sock], [sock], [sock], 1 )
if not res:
print "FAIL"
else:
print "OK", res
except Exception, e:
print e