Hello,
I'd like to ask if there is any scenario that handleIncomingRequest is called for client side?
It seems that function purpose is to handle requests (eg. GET) on server side. Am I right?
However handleIncomingRequest is checking self.responseCallback which is for client side.
If Coap can act as an server and client in a single instance (can't it?) and if self.responseCallback is set and if requested url is unknown (not in self.callbacks) then the function returns False and sendResponse indication "not found" is not called.
if urlCallback is None:
if self.responseCallback:
# The incoming request may be a response, let the responseCallback handle it.
return False
print('Callback for url [', url, "] not found")
self.sendResponse(sourceIp, sourcePort, requestPacket.messageid,
None, macros.COAP_RESPONSE_CODE.COAP_NOT_FOUND,
macros.COAP_CONTENT_FORMAT.COAP_NONE, requestPacket.token)
So my point is that either handleIncomingRequest shall not be called for non requests (ie. GET) or above logic shall be changed to exclude server requests:
if self.responseCallback and macros.COAP_METHOD.COAP_GET != requestPacket.method:
# The incoming request may be a response, let the responseCallback handle it.
return False
Please share your thoughts.
Best regards
Hello,
I'd like to ask if there is any scenario that
handleIncomingRequestis called for client side?It seems that function purpose is to handle requests (eg. GET) on server side. Am I right?
However
handleIncomingRequestis checkingself.responseCallbackwhich is for client side.If
Coapcan act as an server and client in a single instance (can't it?) and ifself.responseCallbackis set and if requested url is unknown (not inself.callbacks) then the function returnsFalseandsendResponseindication "not found" is not called.So my point is that either
handleIncomingRequestshall not be called for non requests (ie. GET) or above logic shall be changed to exclude server requests:Please share your thoughts.
Best regards