Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (15 sloc) 637 Bytes
if callfunc == 'initialize':
# open a connection to the google web server
socketobject = openconn("",80)
# this is a HTTP request...
socketobject.send("GET /index.html HTTP/1.1\r\nHost:\r\n\r\n")
# We'll loop and print information from google.
# We don't "speak" HTTP, so we'll set a timer to close the socket in 3 seconds
settimer(3, socketobject.close, ())
while True:
print socketobject.recv(4096)
except Exception, e: # we got an exception. Did they close the socket?
if str(e) != "Socket closed":