[EMAIL PROTECTED] wrote: > thread1: > while 1: > buf = s.read() > process(buf) > > thread2: > while 1: > buf = getdata() > s.write(buf)
Sockets don't have read() and write() methods. Connected sockets have recv() and send()/sendall(). Python's socket module has a makefile() function, but the resulting file object wouldn't make sense in the read loop above (and throws away control that network code typically needs). Is it safe for one thread to receive from a socket while another sends over the socket? Yes, that much is safe and perfectly reasonable. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list