...
Determine Received UDP Datagram's Interface
If a UDP socket server is bound to the “any” address, then it is not currently possible to know which interface received the UDP datagram. This is a limitation in the BSD socket API. As a solution, the NetSock_CfgIF() function has been implemented in the µC/TCP-IP socket API. With this function, it is possible to associate a socket to a specific interface so that all communications with this socket pass through the specified interface.
...
If no interface is linked to a socket (using NetSock_CfgIF() ) and if a UDP datagram is received on this listening socket bound to the “any” address and the application transmits a response back to the peer using the same socket, then the newly transmitted UDP datagram will be transmitted from the default interface. The default interface may or may not be the interface in which the UDP datagram originated.
...
Applications may call NetSock_IsConn()
to determine if a socket is (still) connected to a remote socket (see function NetSock_IsConn()).
Alternatively, applications may make a non-blocking call to recv()
, NetSock_RxData()
, or NetSock_RxDataFrom()
and inspect the return value. If data or a non-fatal, transitory error is returned, then the socket is still connected; otherwise, if ‘0’ or a fatal error is returned, then the socket is disconnected or closed.
...
When a remote peer closes a socket , and the target application calls one of the receive socket functions, µC/TCP-IP will first report that the receive queue is empty and return a -1 for both BSD and µC/TCP-IP socket API functions. The next call to receive will indicate that the socket has been closed by the remote peer.
...