We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi guys,
why or better when is the accept() returning zero filled IP and PORT? Sometimes I have there right IP and port and sometimes zero filled ip.
SOCKADDR_IN rem_addr = {0}; int addr_len = sizeof(SOCKADDR_IN); int retAccept = accept(rl_sock_id, (SOCKADDR *)&rem_addr, &addr_len );
Network Component Version 7.13.0RTOS2
There is no note about it in documentation https://www.keil.com/pack/doc/mw/Network/html/group__using__network__sockets__bsd__func.html#ga18e88467cfdbc3c361d53b9f928a87ab
Thank you!
The incoming connections in network BSD sockets are accepted or rejected by the protocol stack, not by the application. This concept has advantages and disadvantages. You can read more in the Winsock documentation here: docs.microsoft.com/.../so-conditional-accept If for some reason you call accept() too late, the socket may already be closed, so you can get the IP address unspecified (0.0.0.0)