-
Notifications
You must be signed in to change notification settings - Fork 424
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
why coap client delay #638
Comments
It would be helpful if you could tell us the version of libcoap you are using. The primary reason for UDP packets getting "delayed" is that if the packet type is Confirmable and a previously sent Confirmable packet has not yet been ACK'd by the peer. In other words, if a Confirmable request's response is outstanding, no further Confirmable packets can be sent - hence the delay (Congestion Control) . See https://tools.ietf.org/html/rfc7252#section-4.7 . Updating NSTART is NOT the right answer/fix here. This may be caused by a coding error - possibly fixed in a later version of code) - looking at more of the debug logs should help you here - in particular the actual PDUs being sent / received. |
Thx for your reply! the version is
additionalI subscribed to 2 observation topics. When only one message is pushed, sending and receiving are fine. If I enable another push(client observe) (20HZ), both topics can receive messages, but message sending will always be delayed (maybe at first is good, this phenomenon is not very stable), and the frequency of sending(client get) messages is very low How can I print out the PDU debug msg? |
Your code is reasonably up to date. If the logging level is set to LOG_DEBUG (which it appears to be from your logging output snippet). then each PDU is decoded and printed out. The output line will start with I assume that the 2 observations are in the same client, and that each observation is using its unique token. I also am assuming that the application is not expecting libcoap to be multi-threaded. Correct? |
Yes, because libcoap does not support multi-threading, so I use a shared client, two threads subscribe to data from different topics through one client. One observe topic can receive data and send data well. If I start to send another observe topic, both topics can receive messages, but the client send message will always be delayed (maybe at first is good, this phenomenon is not very stable). logI will print the log and display more detailed information, because there is a topic that contains more frequent messages, so I may need to organize the log |
Providing access to the common client logic is suitably (mutex) protected (both sending requests and receiving responses) then multiple topic threads should be fine. I am assuming that doubling the rate of a single client does not throw up any issues. Are you using a separate |
there's a server singleton called by multiple threads
|
My suspicion it that the server is not multi-thread safe. For example, both server threads cannot individually call |
When the coap client frequently receives data(which use a observe mode), sending data may be unsuccessful(get\put). What is the reason?
below is the debug log
The text was updated successfully, but these errors were encountered: