Question regarding to implement a UDP client using net_app APIs


Robert Chou
 

Hi,

 

I’m comparing implement a UDP client by using net_app and net_context APIs.

 

When using net_context APIs, I’m able to send and receive data from any peer (register receive callback through net_context_recv()).

Since UDP is connectionless, it’s an expected behavior as long as I don’t call net_context_connect().

 

However, if I use net_app APIs to implement a UDP client, it seems that I’m unable to do the same thing.

I’m able to send out the data to the requested peer by calling net_app_send_pkt().

However, I’m unable to receive the data from the peer by registering the receive callback through net_app_set_cb() and without calling net_app_connect().

 

Is this an intended behavior of net_app API?

 

Robert

==---------------------------------------------------------------
This email contains information that is for sole use of the intended recipient and may be confidential or privileged.If you are not the intended recipient, any further review, disclosure, copying, distribution, or use of this email, or the contents of this email is prohibited. Please notify the sender by reply this email and destroy the original email if your receipt of this email is in error.
---------------------------------------------------------------==!!



Michael Scott <michael.scott@...>
 

On 09/06/2017 03:11 AM, Robert.CH.Chou@... wrote:
Hi,
I’m comparing implement a UDP client by using net_app and net_context APIs.
When using net_context APIs, I’m able to send and receive data from any peer (register receive callback through net_context_recv()).
Since UDP is connectionless, it’s an expected behavior as long as I don’t call net_context_connect().
However, if I use net_app APIs to implement a UDP client, it seems that I’m unable to do the same thing.
I’m able to send out the data to the requested peer by calling net_app_send_pkt().
However, I’m unable to receive the data from the peer by registering the receive callback through net_app_set_cb() and without calling net_app_connect().
Is this an intended behavior of net_app API?
Yes, for net_app APIs, this is expected behavior if the UDP client makes use of the net_app_connect() function (required if using DTLS).

I noticed this as well when porting the LwM2M library to net_app APIs recently.

- Mike

Robert
==---------------------------------------------------------------
This email contains information that is for sole use of the intended recipient and may be confidential or privileged.If you are not the intended recipient, any further review, disclosure, copying, distribution, or use of this email, or the contents of this email is prohibited. Please notify the sender by reply this email and destroy the original email if your receipt of this email is in error.
---------------------------------------------------------------==!!
_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel