strange socket behaviour
joewong at mango.cc
Wed Jun 2 04:37:21 CEST 2004
I have a short program that the client make a connection to server, a thread is then created to poll any data sent from the server. The main thread will close the socket after 5 seconds. Here are the code:
from socket import *
i, o, e = select.select([c], , )
if not i:
print "time out"
data = i.recv(1024)
print "data: ", data
c = socket(AF_INET, SOCK_STREAM)
th=threading.Thread(None, poll, "", (c, ))
On Windows, as soon as client socket 'c' is closed, the select() call returns. However, on Linux, the program seems blocking forever ( may be I am not patient to wait ). Is there anything wrong with my code?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list