[docs] [issue5824] SocketServer.DatagramRequestHandler Broken under Linux

Martin Panter report at bugs.python.org
Tue Feb 9 21:53:51 EST 2016

Martin Panter added the comment:

It is not that wfile.getvalue() returns None, it is that self.client_address is None. If the client explicitly binds to a name, then the server gets that name in the client_address, and then everything seems to work properly for me on Linux.

On Linux, using strace and an unbound anonymous client, I see that recvfrom() outputs a zero-length sending address structure, which Python’s makesockaddr() function converts to None with the comment /* No address -- may be recvfrom() from known socket */. The man page <http://man7.org/linux/man-pages/man7/unix.7.html> actually says the address length should be sizeof(sa_family_t) in this case, so maybe that is a minor bug for Linux or the man page.

How does this work on non-Linux platforms? I’m not really familiar with Unix domain sockets, especially datagram ones, but it seems to me that the main confusion is whether DatagramRequestHandler supports anonymous Unix domain clients or not.

As in Issue 1767511, I think DatagramRequestHandler is designed to always send a response back to the sender of the request. If you don’t want to send a response, why are you using this class?

nosy: +martin.panter

Python tracker <report at bugs.python.org>

More information about the docs mailing list