Reputation: 113
I have a coap server running over an ESP32 by using Coap Simple Library.
Inside the loop function, I want to check if coap is connected and if it is stop it. This is my code. Methods bool conneted() and disconnected() or stop don't work.
if( coap.connected() ){
coap.disconnect(); // or coap.stop()
}
Upvotes: 0
Views: 302
Reputation: 824
Do you refer to coap-simple.h, I can't find "connected" nor "disconnect".
If CoAP over UDP (RFC7252) is used, "connected" or "disconnect" doesn't have the same meaning as for TCP. Using UDP there is no connection and the messages are exchanged spontaneous. Using "connect" on UDP then mainly means, that the socket only accepts messages from that peer and not also from others. I don't think, that's what you want.
So, if your concern is, that a server may collapse because of too many "connections", the very good news is: no a UDP server doesn't. Therefore no "connect", no "disconnect".
The open question maybe, why there is no "stop", but that's a question for the CoAP-simple-library project.
Upvotes: 1