This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

coap get address

Hello, 

I want to get the IP address of a CoAP request source (server). According to me, it is close of the objective of the client / server pair mechanism example. So, I use in my request handler the following function :

Is it correct that the function read the IP address of the request and write it in the &m_state.peer_address buffer ? If it is correct, why is the server not reachable with the extracted address ? 

Thanks in advance !

Parents
  • Hi.

    Source and destination address is part of otMessageInfo.

    The simple CoAP client/server examples uses otMessageRead to read server address.

    This is because in the server response, the message server address is sent in the message payload.

    So otMessageRead reads the message payload which is this particular case server address

    Best regards,

    Andreas

Reply
  • Hi.

    Source and destination address is part of otMessageInfo.

    The simple CoAP client/server examples uses otMessageRead to read server address.

    This is because in the server response, the message server address is sent in the message payload.

    So otMessageRead reads the message payload which is this particular case server address

    Best regards,

    Andreas

Children
Related