.\"
.\" @(#)recv.2 8.3 (Berkeley) 2/21/94
.\"
-.Dd May 15, 2006
+.Dd March 18, 2015
.Dt RECV 2
.Os
.Sh NAME
function is normally used only on a
.Em connected
socket (see
-.Xr connect 2 )
+.Xr connect 2
+or
+.Xr connectx 2 )
and is identical to
.Fn recvfrom
with a
specify the destination address if the socket is unconnected;
.Fa msg_name
may be given as a null pointer if no names are desired or required.
+.Pp
The
.Fa msg_iov
and
arguments
describe scatter gather locations, as discussed in
.Xr read 2 .
+.Fa msg_iovlen
+shall be set to the dimension of this array. In each
+.Fa iovec
+structure, the
+.Fa iov_base
+field specifies a storage area and the
+.Fa iov_len
+field gives its size in bytes. Each storage area indicated by
+.Fa msg_iov
+is filled with received data in turn until all of the received data
+is stored or all of the areas have been filled.
+.Pp
The
.Fa msg_control
argument,
field is set on return according to the message received.
.Dv MSG_EOR
indicates end-of-record;
-the data returned completed a record (generally used with sockets of type
-.Dv SOCK_SEQPACKET ) .
+the data returned completed a record.
+.\" (generally used with sockets of type
+.\".Dv SOCK_SEQPACKET ) .
.Dv MSG_TRUNC
indicates that
the trailing portion of a datagram was discarded
.It Bq Er ENOTCONN
The socket is associated with a connection-oriented protocol
and has not been connected (see
-.Xr connect 2
+.Xr connect 2,
+.Xr connectx 2,
and
.Xr accept 2 ) .
.\" ===========
.Bl -tag -width Er
.\" ===========
.It Bq Er EMSGSIZE
-The requested message size is invalid.
+The
+.Fa msg_iovlen
+member of the
+.Fa msghdr
+structure pointed to by message is less than or equal to 0, or is greater than
+.Dv IOV_MAX .
.\" ===========
.It Bq Er ENOMEM
Insufficient memory is available.