Skip to content

tokens missing in response #25

@Extropy

Description

@Extropy

I ran into an issue using this library running on an ESP32, talking to a host application in Python using aiocoap. I am just starting with COAP, so I might be missing something, but I was able to fix it as follows:

Problem: aiocoap would keep sending a message and a reset because it could not associate the response from the ESP32 with a message it had sent. For my application, including the (packet.tokens, packet.tokenlen) in the call to sendResponse fixed the issue, but when the Python script requested an endpoint that I did not have on the ESP32 side, the problem persisted.

Suspected cause: aiocoap using tokens in a way not compatible with CoAP-simple

Work around/fix: I changed line 287/288 of coap-simple.cpp to read:
sendResponse(_udp->remoteIP(), _udp->remotePort(), packet.messageid, NULL, 0,COAP_NOT_FOUNT, COAP_NONE, packet.token, packet.tokenlen); This way, when an unknown URI is requested, the response just also includes any tokens sent.

This fixed the problem. This did not happen when using Linux coap-client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions