BSD 4_3 release
[unix-history] / usr / man / man2 / recv.2
index 7e3c189..1af72a3 100644 (file)
@@ -1,5 +1,11 @@
-.TH RECV 2 "7 July 1983"
-.UC 4
+.\" Copyright (c) 1983 Regents of the University of California.
+.\" All rights reserved.  The Berkeley software License Agreement
+.\" specifies the terms and conditions for redistribution.
+.\"
+.\"    @(#)recv.2      6.3 (Berkeley) 5/23/86
+.\"
+.TH RECV 2 "May 23, 1986"
+.UC 5
 .SH NAME
 recv, recvfrom, recvmsg \- receive a message from a socket
 .SH SYNOPSIS
 .SH NAME
 recv, recvfrom, recvmsg \- receive a message from a socket
 .SH SYNOPSIS
@@ -37,7 +43,7 @@ are used to receive messages from a socket.
 .PP
 The 
 .I recv
 .PP
 The 
 .I recv
-call may be used only on a 
+call is normally used only on a 
 .I connected
 socket (see
 .IR connect (2)),
 .I connected
 socket (see
 .IR connect (2)),
@@ -61,8 +67,8 @@ The length of the message is returned in
 .IR cc .
 If a message is too long to fit in the supplied buffer,
 excess bytes may be discarded depending on the type of socket
 .IR cc .
 If a message is too long to fit in the supplied buffer,
 excess bytes may be discarded depending on the type of socket
-the message is received fromsee
-.IR socket (2).
+the message is received from (see
+.IR socket (2)).
 .PP
 If no messages are available at the socket, the
 receive call waits for a message to arrive, unless
 .PP
 If no messages are available at the socket, the
 receive call waits for a message to arrive, unless
@@ -79,15 +85,15 @@ call may be used to determine when more data arrives.
 .PP
 The
 .I flags
 .PP
 The
 .I flags
-argument to a send call is formed by 
+argument to a recv call is formed by 
 .IR or 'ing
 one or more of the values,
 .PP
 .nf
 .RS
 .IR or 'ing
 one or more of the values,
 .PP
 .nf
 .RS
-.DT
-#define        MSG_PEEK        0x1     /* peek at incoming message */
-#define        MSG_OOB 0x2     /* process out-of-band data */
+.ta \w'#define\ \ 'u +\w'MSG_DONTROUTE\ \ \ 'u +\w'0x\0\0\0\ \ 'u
+#define        MSG_OOB 0x1     /* process out-of-band data */
+#define        MSG_PEEK        0x2     /* peek at incoming message */
 .RE
 .fi
 .PP
 .RE
 .fi
 .PP
@@ -105,7 +111,7 @@ This structure has the following form, as defined in
 struct msghdr {
        caddr_t msg_name;               /* optional address */
        int     msg_namelen;            /* size of address */
 struct msghdr {
        caddr_t msg_name;               /* optional address */
        int     msg_namelen;            /* size of address */
-       struct  iov *msg_iov;           /* scatter/gather array */
+       struct  iovec *msg_iov;         /* scatter/gather array */
        int     msg_iovlen;             /* # elements in msg_iov */
        caddr_t msg_accrights;          /* access rights sent/received */
        int     msg_accrightslen;
        int     msg_iovlen;             /* # elements in msg_iov */
        caddr_t msg_accrights;          /* access rights sent/received */
        int     msg_accrightslen;
@@ -126,11 +132,14 @@ and
 .I msg_iovlen
 describe the scatter gather locations, as described in
 .IR read (2).
 .I msg_iovlen
 describe the scatter gather locations, as described in
 .IR read (2).
-Access rights to be sent along with the message are specified
+A buffer to receive any access rights sent along with the message is specified
 in 
 .IR msg_accrights ,
 which has length
 .IR msg_accrightslen .
 in 
 .IR msg_accrights ,
 which has length
 .IR msg_accrightslen .
+Access rights are currently limited to file descriptors,
+which each occupy the size of an
+.BR int .
 .SH "RETURN VALUE
 These calls return the number of bytes received, or \-1
 if an error occurred.
 .SH "RETURN VALUE
 These calls return the number of bytes received, or \-1
 if an error occurred.
@@ -155,4 +164,4 @@ any data was available for the receive.
 The data was specified to be received into a non-existent
 or protected part of the process address space.
 .SH SEE ALSO
 The data was specified to be received into a non-existent
 or protected part of the process address space.
 .SH SEE ALSO
-read(2), send(2), socket(2)
+fcntl(2), read(2), send(2), select(2), getsockopt(2), socket(2)