-
Notifications
You must be signed in to change notification settings - Fork 420
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
How to make client retransmit its message #163
Comments
Hi Hong, TESTINGThe libcoap recovery/re-transmit logic will only work for confirmable requests. To see what is happening (other than by sniffing the network traffic), the The client needs to be sending confirmable requests during the test. The server can either be stopped, or if packet loss levels are set to 100% by Note: If the server end of the connection is returning ICMP unreachable packets The client should then restart transmitting the requests based on the |
Hi mrdeep1 Apr 09 11:23:22 DEBG ** 127.0.0.1:49048 <-> 127.0.0.1:4646 DTLS tid=29546: retransmission #1 Thanks |
Hi Hong, What actually is happening here is the DTLS session is trying many times before giving up. This is not the retransmit of a CoAP message. That said, I have just raised PR #165 so that the DTLS startup is also subject to the MAX-TRANSMIT value. |
Hi mrdeep1
Can you explain a little bit more? I don't know the result I got is correct or not. The above log is when I made my client sent out an Empty confirmable message (type = 0, code=0). And I saw in the log, that the total retransmits is 4 times as the default value of libcoap. It finally gave up retrying with this message: "Apr 09 11:56:28 DEBG ** 127.0.0.1:49048 <-> 127.0.0.1:4646 DTLS tid=29546: give up after 4 attempts" |
The CoAP message retry rules are As max_transmit is 4, then the 5th retransmit does not get sent, but at that point COAP_NACK_TOO_MANY_RETRIES gets raised in your nack_handler (if defined). Note that the sum of the seconds is 93. Your log entries were showing many DTLS session setup retries before your CoAP Ping was then retried which as you say eventually gave up after 4 retries. The 4 retries did fail after 93 seconds of CoAP message retries, but there was the additional long time consumed by DTLS trying to set up a session (which my code change limits to the default of 4 retransmits). |
I got it. Thank mrdeep1. |
Hi Apr 12 16:02:25 DEBG ** 127.0.0.1:52034 <-> 127.0.0.1:4646 DTLS tid=59092: retransmission #1 Thanks |
It also crashed if I stopped the ping function, and made my client sends one confirmable message only (type 0 , code 1). Do you know what that problem is? Apr 12 16:13:11 DEBG SSL_connect:before SSL initialization |
Hi Hong, Which version of code are you working with?
Is this a PKI or PSK connection? I cannot reproduce what you are seeing at the moment. A full -v9 log may help here. Have you tried debugging your executable to see what 'removed' and 'node' variables contain? |
Hi mrdeep1 Apr 13 09:46:27 DEBG SSL_connect:before SSL initialization |
Hi Hong, Using version f3c1542, I have modified examples coap-client to be able to do PKI. I am running coap-server as 'coap-server -v9 -l 100%' and coap-client as 'coap-client -v7 -c server-cert.pem coaps://127.0.0.1' (-c option is new) and get as output Apr 13 09:53:44 DEBG *** 127.0.0.1:57598 <-> 127.0.0.1:5684 DTLS: new outgoing session There are some notable differences. |
Hi Hong, It is may be worth making the following change to see if the error message is getting reported diff --git a/src/coap_openssl.c b/src/coap_openssl.c - if (!context->psk_pki_enabled) |
Hi mrdeep1
Note : |
Hi Hong, It looks like you are calling coap_send() for the same PDU 3 times - correct? |
Thank mrdeep1 for great help. It was my mistake for setting retry for message in my client. I removed retry and got it work. Hong |
Hi mrdeep1 The retransmission works fine for 1 ~ 2 different messages. When I made my client send out 3 different messages, it crashed again. There seems to be a problem with searching for the target node inside function "net.c/ coap_remove_from_queue()". I added some debug code to have more detail. Apr 14 15:10:07 DEBG ** 127.0.0.1:38693 <-> 127.0.0.1:4646 DTLS tid=29546: delayed The condition expression for do-while() looks strange. That allows the loop to stop at any node with the same session value but different id. I try changing it as below at got it worked
How you do think? |
Hi Hong, Whilst not explicitly stated that multiple confirmable requests can be sent using the same session in RFC7272, it does say and RFC8223 (for TCP) it is more explicit So as I read this, multiple confirmable requests can be sent using a single session before acknowledgements are seen. So, your code change looks good. |
Thank mrdeep1 for replying me. @obgm |
Will so, thank you @hongnguyen-tma and @mrdeep1 |
@hongnguyen-tma Can this now be closed from your perspective? |
@mrdeep1 |
Hi
Do you know how to make the client retransmit its message?
From the source code, it seems that libcoap will invoke the nack_handler with reason = COAP_NACK_TOO_MANY_RETRIES when max-retransmit is reached and I need to test my client with this case.
https://github.com/obgm/libcoap/blob/develop/src/net.c#L935
I tried by stopping the server before making client to send message, but it still not fall into this case. What I got is just :
Apr 07 13:06:57 WARN coap_network_read: unreachable Apr 07 13:06:57 DEBG *** 127.0.0.1:35438 <-> 127.0.0.1:4646 DTLS: session reset Apr 07 13:06:57 DEBG ** 127.0.0.1:35438 <-> 127.0.0.1:4646 DTLS tid=29546: not transmitted after delay
Please share with me if you know any way to make this case happen.
Thanks
The text was updated successfully, but these errors were encountered: