?? socket.3.man
字號:
'\" rtp.\" -*- nroff -*- vim: ft=nroff noautoindent nocindent nosmartindent.\".\" @(#) socket.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 SOCKET 3 "2004/05/16 02:35:35" "strxnet-0_9_2-4" "Linux Fast-STREAMS Sockets Library".SH NAME.B socket\- create an endpoint for communication.SH SYNOPSIS.PP.B #include <sys/socket.h>.HP.BI "int socket(int " domain ", int " type ", int " protocol );.SH DESCRIPTION.PPThe.BR socket ()function creates an unbound socket in a communicationsdomain, and returns a file descriptor that can be used in laterfunction calls that operate on sockets..PPThe function takes the following arguments:.TP.I domainSpecifies the communications domain in which a socket is to becreated..TP.I typeSpecifies the type of socket to be created..TP.I protocolSpecifies a particular protocol to be used with the socket.Specifying a protocol of 0 causes.BR socket ()to use anunspecified default protocol appropriate for the requestedsocket type..PPThe domain argument specifies the address family used in thecommunications domain. The address families supported by the systemare implementation-dependent..PPSymbolic constants that can be used for the domain argument aredefined in the <sys/socket.h> header..PPThe type argument specifies the socket type, which determines thesemantics of communication over the socket. The socket typessupported by the system are implementation-dependent. Possiblesocket types include:.TP.B SOCK_STREAMProvides sequenced, reliable, bidirectional, connection-modebyte streams, and may provide a transmission mechanism forout-of-band data..TP.B SOCK_DGRAMProvides datagrams, which are connectionless-mode, unreliablemessages of fixed maximum length..TP.B SOCK_SEQPACKETProvides sequenced, reliable, bidirectional, connection-modetransmission path for records. A record can be sent using oneor more output operations and received using one or more inputoperations, but a single operation never transfers part of morethan one record. Record boundaries are visible to the receivervia the.B MSG_EORflag..PPIf the protocol argument is non-zero, it must specify a protocolthat is supported by the address family. The protocols supported bythe system are implementation-dependent..PPThe process may need to have appropriate privileges to use the.BR socket ()function or to create some sockets..SH NOTES.PPThe documentation for specific address families specify whichprotocols each address family supports. The documentation forspecific protocols specify which socket types each protocolsupports..PPThe application can determine if an address family is supported bytrying to create a socket with domain set to the protocol inquestion..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 socket ()returns a nonnegative integer,the socket file descriptor. Otherwise a value of -1 is returned and.IR errno (3)is set to indicate the error..SH ERRORS.PPThe.BR socket ()function will fail if:.TP.RB [ EAFNOSUPPORT ]The implementation does not support the specified addressfamily..TP.RB [ EMFILE ]No more file descriptors are available for this process..TP.RB [ ENFILE ]No more file descriptors are available for the system..TP.RB [ EPROTONOSUPPORT ]The protocol is not supported by the address family, or theprotocol is not supported by the implementation..TP.RB [ EPROTOTYPE ]The socket type is not supported by the protocol..PPThe.BR socket ()function may fail if:.TP.RB [ EACCES ]The process does not have appropriate privileges..TP.RB [ ENOBUFS ]Insufficient resources were available in the system to performthe operation..TP.RB [ ENOMEM ]Insufficient memory was available to fulfill the request..TP.RB [ ENOSR ]There were insufficient.IR STREAMS (4)resources available for theoperation to complete..SH "SEE ALSO".PP.BR accept (3),.BR bind (3),.BR connect (3),.BR getsockname (3),.BR getsockopt (3),.BR listen (3),.BR recv (3),.BR recvfrom (3),.BR recvmsg (3),.BR send (3),.BR sendmsg (3),.BR setsockopt (3),.BR shutdown (3),.BR socketpair (3),.BR <netinet/in.h> ,.BR <sys/socket.h> ..SH "CONFORMING TO".PPThe Open Group XNS Issue 5.2..[xns.].\".\".[$LIST$.].TI
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -