This a separate release of the OpenSS7 X/Open XTI/TLI library, TLI modules (timod, tirdwr) and the I

源代码在线查看: accept.3.man

软件大小: 1779 K
上传用户: ddddong
关键词: TLI the separate OpenSS7
下载地址: 免注册下载 普通下载 VIP

相关代码

				'\" rtp				.\" -*- nroff -*- vim: ft=nroff noautoindent nocindent nosmartindent				.\"				.\" @(#) accept.3.man,v 1.1.2.1 2004/05/16 02:35:34 brian Exp				.\"				.\" =========================================================================				.\"				.\" Copyright (C) 2001-2004  OpenSS7 Corporation 				.\"				.\" 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:34 by brian				.\"				.\" =========================================================================				.so strxnet.macros				.R1				bracket-label "\fR[\fB" "\fR]" "\fR, \fB"				no-default-database				database strxnet.refs				accumulate				move-punctuation				abbreviate A				join-authors ", " ", " " and "				et-al " et al" 2 3				abbreviate-label-ranges ".."				sort-adjacent-labels				.R2				.\"				.\"				.TH ACCEPT 3 "2004/05/16 02:35:34" "strxnet-0_9_2-4" "Linux Fast-STREAMS Sockets Library"				.SH NAME				.B accept				\- accept a new connection on a socket				.SH SYNOPSIS				.PP				.B #include 				.HP				.BI "int accept(int " socket ", struct sockaddr *" address ", socklen_t *" address_len );				.SH DESCRIPTION				.PP				The				.BR accept ()				function extracts the first connection on the queue of pending connections,				creates a new socket with the same socket type protocol and address family as				the specified socket, and allocates a new file descriptor for that socket.				.PP				The function takes the following arguments:				.TP				.I socket				Specifies a socket that was created with				.BR socket (3),				has been bound to an				address with				.BR bind (3),				and has issued a successful call to				.BR listen (3).				.TP				.I address				Either a null pointer, or a pointer to a sockaddr structure where the address				of the connecting socket will be returned.				.TP				.I address_len				Points to a socklen_t which on input specifies the length of the supplied				sockaddr structure, and on output specifies the length of the stored address.				.PP				If address is not a null pointer, the address of the peer for the accepted				connection is stored in the sockaddr structure pointed to by address, and the				length of this address is stored in the object pointed to by address_len.				.PP				If the actual length of the address is greater than the length of the supplied				sockaddr structure, the stored address will be truncated.				.PP				If the protocol permits connections by unbound clients, and the peer is not				bound, then the value stored in the object pointed to by address is				unspecified.				.PP				If the listen queue is empty of connection requests and				.B O_NONBLOCK				is not set				on the file descriptor for the socket,				.BR accept ()				will block until a connection is present. If the				.BR listen (3)				queue is empty of				connection requests and				.B O_NONBLOCK				is set on the file descriptor for the				socket,				.BR accept ()				will fail and set errno to				.RB [ EAGAIN ]				or				.RB [ EWOULDBLOCK ].				.PP				The accepted socket cannot itself accept more connections. The original socket				remains open and can accept more connections.				.SH NOTES				.PP				When a connection is available,				.BR select (2)				will indicate that the file				descriptor for the socket is ready for reading.				.SH CAVEATS				.PP				This system call is implemented as a				.B SIOCSOCKSYS				IOCTL.  See				.BR socksys (4)				for more information.				.SH "RETURN VALUE"				.PP				Upon successful completion,				.BR accept ()				returns the non-negative file descriptor				of the accepted socket. Otherwise, -1 is returned and errno is set to indicate				the error.				.SH ERRORS				.PP				The				.BR accept ()				function will fail if:				.TP				.RB [ EAGAIN "] or [" EWOULDBLOCK ]				.B O_NONBLOCK				is set for the socket file descriptor and no connections are				present to be accepted.				.TP				.RB [ EBADF ]				The socket argument is not a valid file descriptor.				.TP				.RB [ ECONNABORTED ]				A connection has been aborted.				.TP				.RB [ EFAULT ]				The address or address_len parameter can not be accessed or written.				.TP				.RB [ EINTR ]				The				.BR accept ()				function was interrupted by a signal that was caught before a valid connection				arrived.				.TP				.RB [ EINVAL ]				The socket is not accepting connections.				.TP				.RB [ EMFILE ]				{OPEN_MAX} file descriptors are currently open in the calling process.				.TP				.RB [ ENFILE ]				The maximum number of file descriptors in the system are already open.				.TP				.RB [ ENOTSOCK ]				The socket argument does not refer to a socket.				.TP				.RB [ EOPNOTSUPP ]				The socket type of the specified socket does not support accepting				connections.				.TP				.RB [ ENOBUFS ]				No buffer space is available.				.TP				.RB [ ENOMEM ]				There was insufficient memory available to complete the operation.				.TP				.RB [ ENOSR ]				There was insufficient STREAMS resources available to complete the operation.				.TP				.RB [ EPROTO ]				A protocol error has occurred; for example, the STREAMS protocol stack has not				been initialised.				.SH "SEE ALSO"				.PP				.BR bind (3),				.BR connect (3),				.BR listen (3),				.BR socket (3),				.BR  (5).				.SH "CONFORMING TO"				.PP				The Open Group XNS Issue 5.2.				.[				xns				.]				.\"				.\"				.[				$LIST$				.]				.TI							

相关资源