Re: [Networking][socket] When is network is ready to accept a socket connection


Jukka Rissanen
 

Hi Karthik,

For IPv4 monitoring NET_EVENT_IPV4_ADDR_ADD is best option atm.
For IPv6 the NET_EVENT_IPV6_DAD_SUCCEED and/or
NET_EVENT_IPV6_ROUTER_ADD should be used instead.

These events are not optimal and some more work is needed in the future
to make this more generic. So something like this draft
https://github.com/zephyrproject-rtos/zephyr/pull/9370 that is still
pending.


Cheers,
Jukka

On Tue, 2019-04-09 at 22:13 +0000, Prabhu Vinod, Karthik wrote:
Hi,

I wanted to know if there are network events which I can subscribe,
to know when the network init is complete. If there is one, I want to
wait and use the callback to notify my app that then It can perform
socket_connection. Because a socket connection on a non-ready network
is blocking call.

I looked through include/net/net_event.h and found that there is
NET_EVENT_IPV4_ADDR_ADD which comes closest to our use case since
assigning IPv4 address to an network interface should be last thing
to perform in a network_boot sequence. Is there something else that I
could do?

Many Regards,
Karthik Prabhu Vinod

Help save the planet by choosing not to use single use plastics. Pick
paper, bamboo or metal cutlery and carry your own bag to the grocery
store. Every little thing you do makes an impact.

Join users@lists.zephyrproject.org to automatically receive all group messages.