| Previous | Next |
| ENOTSOCK | EMSGSIZE |
EDESTADDRREQ
EDESTADDRREQ is normally a datagram-socket configuration error. The program is sending through a socket that is not connection-mode, but it has not supplied a destination address and the socket has no default peer. There is no endpoint to which the kernel can deliver the message.
There are two valid patterns. Use sendto() or sendmsg() and provide the destination for every datagram, which is appropriate when one socket talks to many peers. Or call connect() on a UDP or other datagram socket to set its default peer, then use send(). For datagram protocols, that operation records the peer locally; it does not create a TCP-style transport session.
What to check
- Confirm the socket type; a stream socket normally needs an established connection instead and reports
ENOTCONNwhen it lacks one. - For
sendmsg(), verifymsg_nameandmsg_namelenare populated for an unconnected datagram socket. - Do not retain an address structure whose backing memory has expired or whose family does not match the socket.
POSIX sendmsg() · Linux send(2) · GNU C Library socket error notes
Looking for a different code? Search another status or error code.