eclipse-wakaama / wakaama

Eclipse Wakaama is a C implementation of the Open Mobile Alliance's LightWeight M2M protocol (LWM2M).
BSD 3-Clause "New" or "Revised" License
494 stars 374 forks source link

server write operation , response COAP_400_BAD_REQUEST #734

Closed nanioo closed 6 months ago

nanioo commented 9 months ago

when I start the server and client, i command like "exec 0 /1" 、"write 0 /1" and so on, there is no OK response, but 400, why this response

exec 0 /1 Error: 4.00 (COAP_400_BAD_REQUEST)

nanioo commented 9 months ago

write 0 /1/0/1 20 OK

Client #0 /1/0/1 : 5.03 (COAP_503_SERVICE_UNAVAILABLE) non block transfer 0 bytes received of type text/plain:

and like this

mlasch commented 9 months ago

Hi @nanioo

when I start the server and client, i command like "exec 0 /1" 、"write 0 /1" and so on, there is no OK response, but 400, why this response

Error 4.00 makes sense here, because you try to exec on object instead of resource level. Try a resource which has the executable flag, e.g. exec 0 /1/0/8.

write 0 /1/0/1 20 works for me:

> write 0 /1/0/1 20
OK
> 8 bytes received from [::1]:56830
64 44 7C 45  45 7C C1 86   dD|EE|..

Client #0 /1/0/1 : 2.04 (COAP_204_CHANGED)
    non block transfer
    0 bytes received of type text/plain:

Are you using the Wakaama client and Wakaama server?