Hi, How can I get the RLOC16 or similar ID from the CoAP clients connected to my CoAP server? I need to get this information from the messages that the clients send.
Cheers,
Hi, How can I get the RLOC16 or similar ID from the CoAP clients connected to my CoAP server? I need to get this information from the messages that the clients send.
Cheers,
Hi Sigurd,
Thanks for your reply. Wouldn't this retrieve the RLOC of the server?
I tried the otThreadGetRloc16 () function, but it only got the RLOC16 of the server.
In my instance more than one coap clients will be sending messages to the server. So server needs to get the RLOC16 of each client based on each message.
My client handler in the server is like this
Cheers,
Hi,
kaushalyasat said:I tried the otThreadGetRloc16 () function, but it only got the RLOC16 of the server.
Ah right yes. I misunderstood the question.
For the child RLOC16:
On my OTBR I run "sudo ot-ctl child table" which gives me the following:

See child table.
This links to an API command that you should be able to call to get the RLOC value.
PS: You can also test these CLI commands using our OpenThread CLI sample.
Regards,
Sigurd Hellesvik
thanks, I am using the CLI commands to query the child table and other info. It is a great tool. I can trace that CLI uses 'otThreadGetChildInfoByIndex()' function to get 'childInfo.mRloc16'. But that does not help my case as I need to decode RLOC16 from the message itself to identify who send it. I can encode the client RLOC16 with the message itself, but that I feel like wasting radio bandwidth. I think definitely the senders RLOC16 (or some other address parameter) is available at app level based on the message. So what I am looking for is an API call to extract that from the message, inside the message handler.
Hi, Any reply to this? I think RLOC16 is not a static value which identifies the client accurately. So I am thinking of getting the extended MAC or something similar. Any idea?