How should I handle socket receiving?
n00m
n00m at narod.ru
Fri Mar 11 20:40:32 EST 2011
I'm abs not sure but maybe you'll need to put
each client into separate thread; like this
def Client_func(s2, cn):
while 1:
data = cn.recv(4096)
if not data:
s2.shutdown(1)
return
s2.sendall(data)
cn, addr = s1.accept()
s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2.connect((the_server_host, the_server_port))
thread.start_new_thread(Client_func, (s2, cn,))
More information about the Python-list
mailing list