What does Windows error code 10039 (WSAEDESTADDRREQ) mean?

 
Previous Next
WSAENOTSOCK WSAEMSGSIZE

WSAEDESTADDRREQ

WSAEDESTADDRREQ occurs when Winsock cannot determine where to send a message. A connectionless socket such as UDP may send to an explicit destination with sendto, or it may first be associated with a default peer by connect. Without either, a plain send operation has no recipient.

What it does not mean

The error does not say that DNS failed, that the destination rejected traffic, or that a route is absent. Winsock has not reached that stage: the application has not supplied a usable peer address for this particular call.

Fix the call contract

  • For unconnected datagram traffic, pass a correctly populated destination sockaddr and length to sendto or WSASendTo.
  • For a single recurring peer, connect the datagram socket once and use send/recv consistently.
  • Log family, destination length, and whether the socket is connected; an empty address and an address from the wrong family need different fixes.

Microsoft: sendto · The Open Group: sendto · Microsoft: connect


Looking for a different code? Search another status or error code.