Title: doc: asyncore does not support UDP
Type: behavior Stage:
Components: Documentation, Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Tony.Gedge, docs@python, giampaolo.rodola, santoso.wijaya, vstinner
Priority: normal Keywords: easy

Created on 2014-05-19 03:28 by Tony.Gedge, last changed 2021-05-28 22:54 by iritkatriel.

Messages (4)
msg218780 - (view) Author: Tony Gedge (Tony.Gedge) Date: 2014-05-19 03:28
Sending a zero-length UDP packet to asyncore closes socket by default.

The default implementation of recv() assumes that zero-length data means close.  This isn't true for UDP - it is possible to send a zero-length payload packet.

A possible work-around is to overload handle_close() and not call self.close(). However, as handle_close() is called as part of exception handling, we can't determine whether the handle_close() is happening due to a zero-length payload or an exception event.

It should be possible to process a zero-length payload UDP packet.
msg218799 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2014-05-19 16:11
That doesn't surprise me as asyncore does not natively support UDP protocol in the first place.
msg218828 - (view) Author: Tony Gedge (Tony.Gedge) Date: 2014-05-20 01:37
If it's true that asyncore doesn't support UDP, I'd suggest at least a statement to this effect in the documentation.  As far as I can see, there's nothing to suggest it won't work with UDP.
msg221749 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-27 22:31
For UDP, you can use the new asyncio module for that.

I agree that the asyncore documentation should mention that datagram protocols (UDP) are not supported.
Date User Action Args
2021-05-28 22:54:56iritkatrielsettitle: Sending a zero-length UDP packet to asyncore invokes handle_close() -> doc: asyncore does not support UDP
nosy: + docs@python

assignee: docs@python
versions: + Python 3.9, Python 3.10, Python 3.11, - Python 2.7
components: + Documentation
keywords: + easy
2014-06-27 22:31:14vstinnersetnosy: + vstinner
messages: + msg221749
2014-05-20 01:37:47Tony.Gedgesetmessages: + msg218828
2014-05-19 16:11:00giampaolo.rodolasetnosy: + giampaolo.rodola
messages: + msg218799
2014-05-19 15:52:39santoso.wijayasetnosy: + santoso.wijaya
2014-05-19 03:28:21Tony.Gedgecreate