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

📄 xsh_chap02_10.html

📁 posix标准英文,html格式
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<dd>The destination host has been determined to be down or disconnected.</dd><dt>[EHOSTUNREACH]</dt><dd>The destination host is not reachable.</dd><dt>[EMSGSIZE]</dt><dd>For a connectionless-mode socket, the size of a previously sent datagram prevented delivery.</dd><dt>[ENETDOWN]</dt><dd>The local network connection is not operational.</dd><dt>[ENETRESET]</dt><dd>The connection was aborted by the network.</dd><dt>[ENETUNREACH]</dt><dd>The destination network is not reachable.</dd></dl><h4><a name="tag_02_10_16">  2.10.16 </a>Use of Options</h4><p>There are a number of socket options which either specialize the behavior of a socket or provide useful information. Theseoptions may be set at different protocol levels and are always present at the uppermost &quot;socket&quot; level.</p><p>Socket options are manipulated by two functions, <a href="../functions/getsockopt.html"><i>getsockopt</i>()</a> and <a href="../functions/setsockopt.html"><i>setsockopt</i>()</a>. These functions allow an application program to customize the behavior andcharacteristics of a socket to provide the desired effect.</p><p>All of the options have default values. The type and meaning of these values is defined by the protocol level to which theyapply. Instead of using the default values, an application program may choose to customize one or more of the options. However, inthe bulk of cases, the default values are sufficient for the application.</p><p>Some of the options are used to enable or disable certain behavior within the protocol modules (for example, turn on debugging)while others may be used to set protocol-specific information (for example, IP time-to-live on all the application's outgoingpackets). As each of the options is introduced, its effect on the underlying protocol modules is described.</p><p><a href="#tagtcjh_1">Value of Level for Socket Options</a> shows the value for the socket level.<br></p><center><b><a name="tagtcjh_1"></a> Table: Value of Level for Socket Options</b></center><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Name</b></p></th><th align="center"><p class="tent"><b>Description</b></p></th></tr><tr valign="top"><td align="left"><p class="tent">SOL_SOCKET</p></td><td align="left"><p class="tent">Options are intended for the sockets level.</p></td></tr></table></center><p><a href="#tagtcjh_2">Socket-Level Options</a> lists those options present at the socket level; that is, when the <i>level</i>parameter of the <a href="../functions/getsockopt.html"><i>getsockopt</i>()</a> or <a href="../functions/setsockopt.html"><i>setsockopt</i>()</a> function is SOL_SOCKET, the types of the option value parameters associatedwith each option, and a brief synopsis of the meaning of the option value parameter. Unless otherwise noted, each may be examinedwith <a href="../functions/getsockopt.html"><i>getsockopt</i>()</a> and set with <a href="../functions/setsockopt.html"><i>setsockopt</i>()</a> on all types of socket.<br></p><center><b><a name="tagtcjh_2"></a> Table: Socket-Level Options</b></center><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Option</b></p></th><th align="center"><p class="tent"><b>Parameter Type</b></p></th><th align="center"><p class="tent"><b>Parameter Meaning</b></p></th></tr><tr valign="top"><td align="left"><p class="tent">SO_BROADCAST</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Non-zero requests permission to transmit broadcast datagrams (SOCK_DGRAM sockets only).</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_DEBUG</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Non-zero requests debugging in underlying protocol modules.</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_DONTROUTE</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Non-zero requests bypass of normal routing; route based on destination address only.</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_ERROR</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Requests and clears pending error information on the socket ( <a href="../functions/getsockopt.html"><i>getsockopt</i>()</a> only).</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_KEEPALIVE</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Non-zero requests periodic transmission of keepalive messages (protocol-specific).</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_LINGER</p></td><td align="left"><p class="tent"><b>struct linger</b></p></td><td align="left"><p class="tent">Specify actions to be taken for queued, unsent data on <a href="../functions/close.html"><i>close</i>()</a>: lingeron/off and linger time in seconds.</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_OOBINLINE</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Non-zero requests that out-of-band data be placed into normal data input queue as received.</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_RCVBUF</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Size of receive buffer (in bytes).</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_RCVLOWAT</p></td><td align="left"><p class="tent"><b>int</b></p></td><td align="left"><p class="tent">Minimum amount of data to return to application for input operations (in bytes).</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_RCVTIMEO</p></td><td align="left"><p class="tent"><b>struct timeval</b></p></td><td align="left"><p class="tent">Timeout value for a socket receive operation.</p></td></tr><tr valign="top"><td align="left"><p class="tent">SO_REUSEADDR</p></td><td align="left">

⌨️ 快捷键说明

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