Weird problem with UDP and gevent
Roy Smith
roy at panix.com
Fri Oct 18 14:44:02 EDT 2013
On Friday, October 18, 2013 1:04:38 PM UTC-4, James Harris wrote:
> Those are two different things. You would normally use connect() on a
> SOCK_STREAM socket. It requires that the remote endpoint, in this case
> localhost:9700, has an open socket listening for connections. sendto() is
> the right thing to use with SOCK_DGRAM.
You are supposed to be able to call connect() on a UDP socket. All it does is store the remote address in the kernel socket structure. Doing connect() followed by a series of send()s is nominally more efficient than doing a series of sendto()s.
I forgot to mention that the connect()/send() code works just fine if I switch my gunicorn config from gevent to sync workers.
More information about the Python-list
mailing list