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

Clarification on cancelling a block-wise request in the middle of transaction at client's end #1436

Open
fun-works opened this issue Jun 6, 2024 · 4 comments

Comments

@fun-works
Copy link

Environment

  • Build System: [CMake]
  • Operating System: [Linux]
  • Operating System Version: [ ]
  • Hosted Environment: [None]

libcoap Configuration Summary

Libcoap version 4.3.4

Problem Description

I am transferring a large file using blockwise transfer. I want to have an option to provide a max time-out value upon which the transfer would stop if it is not completed. Is there an option in libcoap to do that ?

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Jun 6, 2024

It would be helpful to know which way the large file is getting transferred. Also, whether you are using the Block (RFC7959) or Q-Block (RFC9177) methods. The CoAP protocol has different timeouts (RFC7252 and RFC9177), some of which are configurable by libcoap (furthermore some of the derived timeouts have configurable sub-component timeouts).

@fun-works
Copy link
Author

fun-works commented Jun 6, 2024

We are using coap_add_data_large_request() to provide the large chunk of data available in heap. We are using Block transfer and not Q-BLock.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Jun 6, 2024

So, assuming that you are using CON over DTLS/UDP, then for the transmission of an individual block, it will timeout after MAX_TRANSMIT_WAIT which defaults to 93 seconds if that block is not acknowledged by the server (lossy network / server crashes etc.). MAX_TRANSMIT_WAIT can be changed by modifying ACK_TIMEOUT and MAX_RETRANSMIT (don't change ACK_RANDOM_FACTOR) - see coap_recovery(3).

For this, the NACK handler is called with COAP_NACK_TOO_MANY_RETRIES after MAX_TRANSMIT_WAIT .

From the coap-server's perspective, if it does not receive all of the blocks of the file after an idle time (no packets seen) of _MAX_TRANSMIT_WAIT before the giving up on receiving all the blocks of the overall payload.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Jul 10, 2024

@fun-works Do you need any more help on this, or can this now be clossed?

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