⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recv.3.man

📁 This a separate release of the OpenSS7 X/Open XTI/TLI library, TLI modules (timod, tirdwr) and the I
💻 MAN
字号:
'\" rtp.\" -*- nroff -*- vim: ft=nroff noautoindent nocindent nosmartindent.\".\" @(#) recv.3.man,v 1.1.2.1 2004/05/16 02:35:35 brian Exp.\".\" =========================================================================.\".\" Copyright (C) 2001-2004  OpenSS7 Corporation <www.openss7.com>.\".\" All Rights Reserved..\".\" Permission is granted to make and distribute verbatim copies of this.\" manual provided the copyright notice and this permission notice are.\" preserved on all copies..\".\" Permission is granted to copy and distribute modified versions of this.\" manual under the conditions for verbatim copying, provided that the.\" entire resulting derived work is distributed under the terms of a.\" permission notice identical to this one.\" .\" Since the Linux kernel and libraries are constantly changing, this.\" manual page may be incorrect or out-of-date.  The author(s) assume no.\" responsibility for errors or omissions, or for damages resulting from.\" the use of the information contained herein.  The author(s) may not.\" have taken the same level of care in the production of this manual,.\" which is licensed free of charge, as they might when working.\" professionally..\" .\" Formatted or processed versions of this manual, if unaccompanied by.\" the source, must acknowledge the copyright and authors of this work..\".\" -------------------------------------------------------------------------.\".\" U.S. GOVERNMENT RESTRICTED RIGHTS.  If you are licensing this Software.\" on behalf of the U.S. Government ("Government"), the following.\" provisions apply to you.  If the Software is supplied by the Department.\" of Defense ("DoD"), it is classified as "Commercial Computer Software".\" under paragraph 252.227-7014 of the DoD Supplement to the Federal.\" Acquisition Regulations ("DFARS") (or any successor regulations) and the.\" Government is acquiring only the license rights granted herein (the.\" license rights customarily provided to non-Government users).  If the.\" Software is supplied to any unit or agency of the Government other than.\" DoD, it is classified as "Restricted Computer Software" and the.\" Government's rights in the Software are defined in paragraph 52.227-19.\" of the Federal Acquisition Regulations ("FAR") (or any success.\" regulations) or, in the cases of NASA, in paragraph 18.52.227-86 of the.\" NASA Supplement to the FAR (or any successor regulations)..\".\" =========================================================================.\" .\" Commercial licensing and support of this software is available from.\" OpenSS7 Corporation at a fee.  See http://www.openss7.com/.\" .\" =========================================================================.\".\" Last Modified 2004/05/16 02:35:35 by brian.\".\" =========================================================================.so strxnet.macros.R1bracket-label "\fR[\fB" "\fR]" "\fR, \fB"no-default-databasedatabase strxnet.refsaccumulatemove-punctuationabbreviate Ajoin-authors ", " ", " " and "et-al " et al" 2 3abbreviate-label-ranges ".."sort-adjacent-labels.R2.\".\".\".\".TH RECV 3 "2004/05/16 02:35:35" "strxnet-0_9_2-4" "Linux Fast-STREAMS Sockets Library".SH NAME.B recv\- receive a message from a connected socket.SH SYNOPSIS.PP.B #include <sys/socket.h>.HP.BI "ssize_t recv(int " socket ", void *" buffer ", size_t " length ", int " flags );.SH DESCRIPTION.PPThe.BR recv ()function receives a message from a connection-mode orconnectionless-mode socket. It is normally used with connected sockets becauseit does not permit the application to retrieve the source address of receiveddata. The function takes the following arguments:.TP.I socketSpecifies the socket file descriptor..TP.I bufferPoints to a buffer where the message should be stored..TP.I lengthSpecifies the length in bytes of the buffer pointed to by the.I bufferargument..TP.I flagsSpecifies the type of message reception. Values of this argument are formed bylogically OR'ing zero or more of the following values:.RS.TP.B MSG_PEEKPeeks at an incoming message. The data is treated as unread and the next.BR recv ()or similar function will still return this data..TP.B MSG_OOBRequests out-of-band data. The significance and semantics of out-of-band dataare protocol-specific..TP.B MSG_WAITALLRequests that the function block until the full amount of data requested canbe returned. The function may return a smaller amount of data if a signal iscaught, if the connection is terminated, if.B MSG_PEEKwas specified, or if anerror is pending for the socket..RE.PPThe.BR recv ()function returns the length of the message written to the bufferpointed to by the.I bufferargument. For message-based sockets such as.B SOCK_DGRAMand.BR SOCK_SEQPACKET ,the entire message must be read in a singleoperation. If a message is too long to fit in the supplied buffer, and.B MSG_PEEKis not set in the.I flagsargument, the excess bytes are discarded. Forstream-based sockets such as.BR SOCK_STREAM ,message boundaries are ignored. Inthis case, data is returned to the user as soon as it becomes available, andno data is discarded..PPIf the MSG_WAITALL flag is not set, data will be returned only up to the endof the first message..PPIf no messages are available at the socket and.B O_NONBLOCKis not set on thesocket's file descriptor,.BR recv ()blocks until a message arrives. If nomessages are available at the socket and.B O_NONBLOCKis set on the socket'sfile descriptor,.BR recv ()fails and sets errno to.RB [ EAGAIN "] or [" EWOULDBLOCK ]..SH NOTES.PPThe.BR recv ()function is identical to.BR recvfrom (3)with a zero address_lenargument, and to.BR read (2)if no.I flagsare used..PPThe.BR select (2)and.BR poll (2)functions can be used to determine when data isavailable to be received..SH CAVEATS.PPThis system call is implemented as a.B SIOCSOCKSYSIOCTL.  See.BR socksys (4)for more information..SH "RETURN VALUE".PPUpon successful completion,.BR recv ()returns the length of the message in bytes.If no messages are available to be received and the peer has performed anorderly shutdown,.BR recv ()returns 0.  Otherwise, -1 is returned and errno isset to indicate the error..SH ERRORS.PPThe.BR recv ()function will fail if:.TP.RB [ EAGAIN "] or [" EWOULDBLOCK ]The socket's file descriptor is marked.B O_NONBLOCKand no data is waiting to bereceived; or.B MSG_OOBis set and no out-of-band data is available and eitherthe socket's file descriptor is marked.B O_NONBLOCKor the socket does notsupport blocking to await out-of-band data..TP.RB [ EBADF ]The.I socketargument is not a valid file descriptor..TP.RB [ ECONNRESET ]A connection was forcibly closed by a peer..TP.RB [ EFAULT ]The.I bufferparameter can not be accessed or written..TP.RB [ EINTR ]The.BR recv ()function was interrupted by a signal that was caught, before anydata was available..TP.RB [ EINVAL ]The.B MSG_OOBflag is set and no out-of-band data is available..TP.RB [ ENOTCONN ]A receive is attempted on a connection-mode socket that is not connected..TP.RB [ ENOTSOCK ]The.I socketargument does not refer to a socket..TP.RB [ EOPNOTSUPP ]The specified.I flagsare not supported for this socket type or protocol..TP.RB [ ETIMEDOUT ]The connection timed out during connection establishment, or due to atransmission timeout on active connection..PPThe.BR recv ()function may fail if:.TP.RB [ EIO ]An I/O error occurred while reading from or writing to the file system..TP.RB [ ENOBUFS ]Insufficient resources were available in the system to perform the operation..TP.RB [ ENOMEM ]Insufficient memory was available to fulfill the request..TP.RB [ ENOSR ]There were insufficient.IR STREAMS (4)resources available for the operation tocomplete..SH "SEE ALSO".PP.BR poll (2),.BR read (2),.BR recvmsg (3),.BR recvfrom (3),.BR select (2),.BR send (3),.BR sendmsg (3),.BR sendto (3),.BR shutdown (3),.BR socket (3),.BR write (2),.BR <sys/socket.h> (5)..SH "CONFORMING TO".PPThe Open Group XNS Issue 5.2..[xns.].\".\".[$LIST$.].TI

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -