The following code snippet demonstrates a technique that can be used to call WSAIoctl with the SIO_UDP_CONNRESET control code to obtain the original Windows NT 4.0 behavior.
DWORDdwBytesReturned = 0;
BOOLbNewBehavior = FALSE;
// disable new behavior using
// IOCTL: SIO_UDP_CONNRESET
status = WSAIoctl(sd, SIO_UDP_CONNRESET,
NULL, 0, &dwBytesReturned,
if (SOCKET_ERROR == status)
DWORD dwErr = WSAGetLastError();
if (WSAEWOULDBLOCK == dwErr)
// nothing to do
printf("WSAIoctl(SIO_UDP_CONNRESET) Error: %d\n", dwErr);
// MS Transport Provider IOCTL to control
// reporting PORT_UNREACHABLE messages
// on UDP sockets via recv/WSARecv/etc.
// Path TRUE in input buffer to enable (default if supported),
// FALSE to disable.
In order to compile this code, it is necessary to have the latest Platform SDK installed on your computer. This is available from the following MSDN Web site:
This problem was first corrected in Windows 2000 Service Pack 2.