SCCS-vsn: lib/libc/sys/send.2 6.3
SCCS-vsn: lib/libc/sys/recv.2 6.2
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
-.\" @(#)recv.2 6.1 (Berkeley) %G%
+.\" @(#)recv.2 6.2 (Berkeley) %G%
-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)),
-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
+.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
#define MSG_OOB 0x1 /* process out-of-band data */
#define MSG_PEEK 0x2 /* peek at incoming message */
.RE
.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.
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)
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
-.\" @(#)send.2 6.2 (Berkeley) %G%
+.\" @(#)send.2 6.3 (Berkeley) %G%
the message to be transmitted, then
.I send
normally blocks, unless the socket has been placed in
the message to be transmitted, then
.I send
normally blocks, unless the socket has been placed in
The
.IR select (2)
call may be used to determine when it is possible to
The
.IR select (2)
call may be used to determine when it is possible to
-parameter may be set to MSG_OOB to send \*(lqout-of-band\*(rq
-data on sockets that support this notion (e.g. SOCK_STREAM).
+parameter may include one or more of the following:
+.PP
+.nf
+.RS
+.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_DONTROUTE 0x4 /* bypass routing, use direct interface */
+.RE
+.fi
+The flag MSG_OOB is used to send \*(lqout-of-band\*(rq
+data on sockets that support this notion (e.g. SOCK_STREAM);
+the underlying protocol must also support \*(lqout-of-band\*(rq data.
+MSG_DONTROUTE is usually used only by diagnostic or routing programs.
[EWOULDBLOCK]
The socket is marked non-blocking and the requested operation
would block.
[EWOULDBLOCK]
The socket is marked non-blocking and the requested operation
would block.
+.TP 20
+[ENOBUFS]
+The system was unable to allocate an internal buffer.
+The operation may succeed when buffers become available.
+.TP 20
+[ENOBUFS]
+The output queue for a network interface was full.
+This generally indicates that the interface has stopped sending,
+but may be caused by transient congestion.
+fcntl(2), recv(2), select(2), getsockopt(2), socket(2), write(2)