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
#!/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], [], [], 1 )
print "ready"
except Exception, e:
print e