Re: is socket thread safe?

2006-02-16 Thread Carl J. Van Arsdall
Jean-Paul Calderone wrote: > On Wed, 15 Feb 2006 12:59:03 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> > wrote: > >> Steve Horsley wrote: >> >>> [EMAIL PROTECTED] wrote: >>> >>> thread1: while 1: buf = s.read() process(buf) threa

Re: is socket thread safe?

2006-02-16 Thread Carl J. Van Arsdall
Bryan Olson wrote: > Carl J. Van Arsdall wrote: > >> Steve Horsley wrote: >> >> >>> [EMAIL PROTECTED] wrote: >>> >>> >>> thread1: while 1: buf = s.read() process(buf) thread2: while 1: buf = getdata()

Re: is socket thread safe?

2006-02-15 Thread Bryan Olson
Carl J. Van Arsdall wrote: > Steve Horsley wrote: > >> [EMAIL PROTECTED] wrote: >> >> >>> thread1: >>> while 1: >>> buf = s.read() >>> process(buf) >>> >>> thread2: >>> while 1: >>> buf = getdata() >>> s.write(buf) >> >> >> It is safe, but watch out fo

Re: is socket thread safe?

2006-02-15 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Bryan Olson <[EMAIL PROTECTED]> wrote: > 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. I hear it works on most common platforms these days, anyway. I have seen socket i

Re: is socket thread safe?

2006-02-15 Thread Jean-Paul Calderone
On Wed, 15 Feb 2006 12:59:03 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Steve Horsley wrote: >> [EMAIL PROTECTED] wrote: >> >>> thread1: >>> while 1: >>> buf = s.read() >>> process(buf) >>> >>> thread2: >>> while 1: >>> buf = getdata() >>> s.wr

Re: is socket thread safe?

2006-02-15 Thread Bryan Olson
[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

Re: is socket thread safe?

2006-02-15 Thread Carl J. Van Arsdall
Steve Horsley wrote: > [EMAIL PROTECTED] wrote: > >> thread1: >> while 1: >> buf = s.read() >> process(buf) >> >> thread2: >> while 1: >> buf = getdata() >> s.write(buf) >> >> > > It is safe, but watch out for this gotcha: If thread B calls > s.close

Re: is socket thread safe?

2006-02-15 Thread Steve Horsley
[EMAIL PROTECTED] wrote: > thread1: > while 1: > buf = s.read() > process(buf) > > thread2: > while 1: > buf = getdata() > s.write(buf) > It is safe, but watch out for this gotcha: If thread B calls s.close() while thread A is blocked in s.read(), thread

Re: is socket thread safe?

2006-02-14 Thread Rene Pijlman
[EMAIL PROTECTED]: >[code] I certainly expect socket to be threadsafe. I use it (via urllib2/httplib) in a multithreaded program, that runs fine with Python 2.3 and 2.4 on both Windows XP and Linux. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

is socket thread safe?

2006-02-14 Thread e2wugui
thread1: while 1: buf = s.read() process(buf) thread2: while 1: buf = getdata() s.write(buf) -- http://mail.python.org/mailman/listinfo/python-list