doc: coap_server: fix msg size
The sizeof operator applied to a pointer to char does not return the number of characters. This leads to the message being cut off. Instead we should use strlen. Signed-off-by: Sandro Scherer <sand.scherer@gmail.com>
This commit is contained in:
parent
89ba317a55
commit
b2213920f2
1 changed files with 1 additions and 1 deletions
|
@ -100,7 +100,7 @@ The following is an example of a CoAP resource registered with our service:
|
|||
|
||||
/* Append payload */
|
||||
coap_packet_append_payload_marker(&response);
|
||||
coap_packet_append_payload(&response, (uint8_t *)msg, sizeof(msg));
|
||||
coap_packet_append_payload(&response, (uint8_t *)msg, strlen(msg));
|
||||
|
||||
/* Send to response back to the client */
|
||||
return coap_resource_send(resource, &response, addr, addr_len, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue