Thread safety of UDP sendto

Jeffrey W. Collyer jwc3f at Virginia.EDU
Thu Jun 21 17:15:53 EDT 2001


An odd question perhaps, but is Python's UDP socket.sendto() thread safe?

I have a multi-threaded app that I would like to send off some UDP packets.
The data for the packets is gathered in each thread.  If I get a socket 
handle in each thread it will be less efficient than if I open one upon 
program start and then have each thread just do an
ubersocket.sendto(data,ADDR).  Or am I missing something more basic?

What I really need is an atomic write function that handles threading, but
I'll settle for a cheap UDP solution.

-- 
peace 
Jeffrey W. Collyer
jwc3f at virginia.edu




More information about the Python-list mailing list