.Ft ssize_t
.Fo sendmsg
.Fa "int socket"
-.Fa "const struct msghdr *buffer"
+.Fa "const struct msghdr *message"
.Fa "int flags"
.Fc
.Ft ssize_t
.Fa "socklen_t dest_len"
.Fc
.Sh DESCRIPTION
-.Fn Send ,
+.Fn send ,
.Fn sendto ,
and
.Fn sendmsg
are used to transmit a message to another socket.
-.Fn Send
+.Fn send
may be used only when the socket is in a
.Em connected
state, while
.Dv MSG_DONTROUTE
is usually used only by diagnostic or routing programs.
.Pp
+The
+.Fn sendmsg
+system call uses a
+.Fa msghdr
+structure to minimize the number of directly supplied arguments.
+The
+.Fa msg_iov
+and
+.Fa msg_iovlen
+fields of message specify zero or more buffers
+containing the data to be sent.
+.Fa msg_iov
+points to an array of iovec structures;
+.Fa msg_iovlen
+shall be set to the dimension of this array.
+In each iovec structure, the
+.Fa iov_base
+field specifies a storage area and
+the
+.Fa iov_len
+field gives its size in bytes. Some of these sizes can be zero.
+The data from each storage area indicated by
+.Fa msg_iov
+is sent in turn.
See
.Xr recv 2
-for a description of the
+for a complete description of the
.Fa msghdr
structure.
.Sh RETURN VALUES
.It Bq Er EMSGSIZE
The socket requires that message be sent atomically,
and the size of the message to be sent makes this impossible.
+.Dv IOV_MAX .
.\" ===========
.It Bq Er ENETDOWN
The local network interface used to reach the destination is down.
or the socket is connection-mode and is no longer connected.
In the latter case, and if the socket is of type SOCK_STREAM,
the SIGPIPE signal is generated to the calling thread.
+.\" ==========
+.It Bq Er EADDRNOTAVAIL
+The specified address is not available or no longer available on this machine.
.El
.Pp
The
.\" ===========
.It Bq Er EINVAL
The sum of the iov_len values overflows an ssize_t.
+.\" ===========
+.It Bq Er EMSGSIZE
+The socket requires that message be sent atomically,
+and the size of the message to be sent makes this impossible,
+or the msg_iovlen member of the msghdr structure pointed to by message
+is less than or equal to 0 or is greater than
+.Dv IOV_MAX .
.El
.Sh LEGACY SYNOPSIS
.Fd #include <sys/types.h>