On Tue, Sep 22, 2015, at 15:45, James Harris wrote: > "Dennis Lee Bieber" <wlfr...@ix.netcom.com> wrote in message > news:mailman.12.1442794762.28679.python-l...@python.org... > > On Sun, 20 Sep 2015 23:36:30 +0100, "James Harris" > > <james.harri...@gmail.com> declaimed the following: > >>Receiving no bytes is taken as indicating the end of the > >>communication. > >>That's OK for TCP but not for UDP so there should be a way to > >>distinguish between the end of data and receiving an empty datagram. > >> > > I don't believe UDP supports a truly empty datagram (length of 0) -- > > presuming a sending stack actually sends one, the receiving stack will > > probably drop it as there is no data to pass on to a client (there is > > a PR > > at work because we have a UDP driver that doesn't drop 0-length > > messages, > > but also can't deliver them -- so the circular buffer might fill with > > undeliverable headers) > > As others have pointed out, UDP implementations do seem to work with > zero-byte datagrams properly. Again, I would rather see that in the > Python documentation which is what, effectively, forms a contract that > we should be able to rely on.
Isn't this technically the same problem as pressing ctrl-d at a terminal - it's not _really_ the end of the input (you can continue reading after), but it sends the program something it will interpret as such? -- https://mail.python.org/mailman/listinfo/python-list