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

📄 syscalls_54.html

📁 Linux系统调用
💻 HTML
字号:
<!-- This HTML file has been created by texi2html 1.29
     from syscalls.texi on 4 June 1994 -->

<TITLE>Syscall specifications of Linux - socket</TITLE>
<P>Go to the <A HREF="syscalls_53.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_53.html">previous</A>, <A HREF="syscalls_55.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_55.html">next</A> section.<P>
<H2><A NAME="SEC54" HREF="syscalls_toc.html#SEC54" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_toc.html#SEC54">socket</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int socket(int <VAR>domain</VAR>, int <VAR>type</VAR>, int <VAR>protocol</VAR>);</CODE>
 
<H3>PARAMETERS</H3>
<P>
<VAR>domain</VAR>: [in] the protocol family of the socket.
<P>
<VAR>type</VAR>: [in] its type.
<P>
<VAR>protocol</VAR>: [in] the protocol used for communications.
<P>
<H3>DESCRIPTION</H3>
<P>
Creates a communication endpoint. The <VAR>domain</VAR> parameter can take
the following values:
<P>
<DL COMPACT>
<DT><CODE>AF_UNIX</CODE>
<DD>Unix internal protocols.
<P>
<DT><CODE>AF_INET</CODE>
<DD>ARPA protocols (TCP/IP and so on).
<P>
<DT><CODE>AF_ISO</CODE>
<DD>ISO protocols.
<P>
<DT><CODE>AF_NS</CODE>
<DD>Xerox Network System protocols.
<P>
<DT><CODE>AF_IMPLINK</CODE>
<DD>IMP link layer.
</DL>
<P>
As of version 1.0 of Linux: <CODE>AF_ISO</CODE>, <CODE>AF_IMPLINK</CODE> and
<CODE>AF_NS</CODE> are not supported.
<P>
The <VAR>type</VAR> parameter may take the following values:
<P>
<DL COMPACT>
<DT><CODE>SOCK_STREAM</CODE>
<DD>full-duplex, reliable, sequenced, connection-oriented stream. Out-of-band data
may be supported.
<P>
<DT><CODE>SOCK_DGRAM</CODE>
<DD>connection-less, unreliable link for datagram transmission.
<P>
<DT><CODE>SOCK_RAW</CODE>
<DD>only a task with superuser privileges may use this options (see kernel).
<P>
<DT><CODE>SOCK_SEQPACKET</CODE>
<DD>full-duplex, reliable, sequenced, connection-oriented link for datagram
of a specified size. Usable only with the <CODE>AF_NS</CODE> domain.
<P>
<DT><CODE>SOCK_RDM</CODE>
<DD>not implemented yet.
</DL>
<P>
The <CODE>SOCK_STREAM</CODE> type provide reliable transmission. Even when the
connection is not transmitting usefull information, a packet is send at
a regular interval to ensure that the connection is still intact.
<P>
<H3>RETURN VALUE</H3>
<P>
On success, a new file descriptor for the socket is returned. On error,
-1 is returned and <CODE>errno</CODE> is set to one of the following values:
<P>
<UL>
<LI><CODE>EACCESS</CODE>: the calling task does not have permission to
create a socket of the specified domain, type and protocol.
<LI><CODE>EPROTONOSUPPORT</CODE>, <CODE>EMFILE</CODE>, <CODE>ENFILE</CODE> or <CODE>ENOBUFFS</CODE>.
</UL>
<P>
<P>Go to the <A HREF="syscalls_53.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_53.html">previous</A>, <A HREF="syscalls_55.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_55.html">next</A> section.<P>

⌨️ 快捷键说明

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