Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get all partial packages received instead of discarding them? #312

Open
araldit opened this issue Jul 19, 2023 · 3 comments
Open

Get all partial packages received instead of discarding them? #312

araldit opened this issue Jul 19, 2023 · 3 comments

Comments

@araldit
Copy link

araldit commented Jul 19, 2023

Hi,

I'm sending a large message from an embedded client. If I only eg. get, lets say 9 out of 10 messages through, all packages will get lost due to a retransmission timeout. What will be the best way to catch a timeout exception and retrieve the received bytes before the message gets released from memory?

@chrysn
Copy link
Owner

chrysn commented Jul 19, 2023

Just to clarify: The embedded client sends a block-wise request with a large request body that gets fragmented. The CoAP server is implemented in aiocoap, and is supposed to process what has been received. Is that right?

If so, there are two avenues:

  • Notifying the application on partial requests being evicted is currently not implemented. Might be feasible, though, as an extension; will need good understanding of use cases.
  • The handler can opt out of the server-side block-wise processing. For that, it'd implement async def needs_blockwise_assembly(self, request) to return False, or implement render_to_pipe right away. The server will then be fed the blocks individually. Then it can either act on the requests as they come in, or use some mechanisms otherwise implemented (currently) in aiocoap.interfaces.Resource._redner_to_pipe. Note that the helpers that takes from aiocoap.blockwise are not exactly super stable API, so if you use them, consider pinning your aiocoap version precisely. The change log will tell when things happen there.

@araldit
Copy link
Author

araldit commented Jul 19, 2023

The use case you describe is exactly right.

I am investigating solution number 2. If a block wise transfer is ongoing from client -> server, when does the server stop listening for the new messages - what part of the code schedules this?

@chrysn
Copy link
Owner

chrysn commented Jul 19, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants