Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The recv() function does not return SOCKET_ERROR when an ICMP message for a port unreachable is received because this is considered a normal behavior in networking. When a UDP packet is sent to a port that is not open on the target host or has been filtered by a firewall, the target host responds with an ICMP message of type "Port Unreachable". This behavior is expected and is not considered an error in the transport layer protocol. Therefore, recv() does not treat it as an error condition but rather as a valid response from the host being communicated with.