Send and receive data through CoAP using Thread

Wave I am using nRF9160: nRF CoAP Client and Thread: CoAP Server Thread: CoAP Server samples on a network. I can transfer built-in Unicast and Multicast messages, but I couldn't find a way to transfer custom data from client to server. In the CoAP Client, I used the following function to send data to CoAP Server, and it sent the data, but I couldn't receive it properly from the CoAP Server's end.

coap_client.c

static void on_nus_received(struct bt_conn *conn, const uint8_t *const data, uint16_t len)
{
coap_send_request(COAP_METHOD_PUT, (const struct sockaddr *)&multicast_local_addr, light_option, &data, sizeof(data), NULL);
}

How could I receive the data I am sending above from the CoAP Client to the CoAP Server? Is there a function like that to receive the data from CoAP Server?

Parents Reply Children
No Data
Related