On 9/21/2023 6:53 AM, Petro Karashchenko wrote:
setting "address.sin_addr.s_addr" + "bind" is kind of a way you can use to receive requests only from an interface that has a specific IP address. This is useful if your system has multiple network interfaces and you want to provide some kind of isolation. "address.sin_addr.s_addr = INADDR_ANY;" + "bind" is a way that you say "I want to receive requests from any interface".
That is the way other server logic works. See apps/netutils/netlib_server.c and apps/netutuils/netlib_listenon.c.
The only part that confuses me is that INADDR_ANY is zero. address is passed to bind() as read-only, const. So address.sin_addr should still be zero.