| <html lang="en"> |
| <head> |
| <title>Socket-Level Options - The GNU C Library</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="The GNU C Library"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Socket-Options.html#Socket-Options" title="Socket Options"> |
| <link rel="prev" href="Socket-Option-Functions.html#Socket-Option-Functions" title="Socket Option Functions"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU C library. |
| |
| This is Edition 0.12, last updated 2007-10-27, |
| of `The GNU C Library Reference Manual', for version |
| 2.8 (Sourcery G++ Lite 2011.03-41). |
| |
| Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, |
| 2003, 2007, 2008, 2010 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being ``Free Software Needs Free Documentation'' |
| and ``GNU Lesser General Public License'', the Front-Cover texts being |
| ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A |
| copy of the license is included in the section entitled "GNU Free |
| Documentation License". |
| |
| (a) The FSF's Back-Cover Text is: ``You have the freedom to |
| copy and modify this GNU manual. Buying copies from the FSF |
| supports it in developing GNU and promoting software freedom.''--> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| <link rel="stylesheet" type="text/css" href="../cs.css"> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Socket-Level-Options"></a> |
| <a name="Socket_002dLevel-Options"></a> |
| <p> |
| Previous: <a rel="previous" accesskey="p" href="Socket-Option-Functions.html#Socket-Option-Functions">Socket Option Functions</a>, |
| Up: <a rel="up" accesskey="u" href="Socket-Options.html#Socket-Options">Socket Options</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">16.12.2 Socket-Level Options</h4> |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <div class="defun"> |
| — Constant: int <b>SOL_SOCKET</b><var><a name="index-SOL_005fSOCKET-1831"></a></var><br> |
| <blockquote><p>Use this constant as the <var>level</var> argument to <code>getsockopt</code> or |
| <code>setsockopt</code> to manipulate the socket-level options described in |
| this section. |
| </p></blockquote></div> |
| |
| <p><a name="index-sys_002fsocket_002eh-1832"></a>Here is a table of socket-level option names; all are defined in the |
| header file <samp><span class="file">sys/socket.h</span></samp>. |
| |
| <dl> |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <dt><code>SO_DEBUG</code><dd><!-- Extra blank line here makes the table look better. --> |
| |
| <p>This option toggles recording of debugging information in the underlying |
| protocol modules. The value has type <code>int</code>; a nonzero value means |
| “yes”. |
| <!-- !!! should say how this is used --> |
| <!-- OK, anyone who knows, please explain. --> |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_REUSEADDR</code><dd>This option controls whether <code>bind</code> (see <a href="Setting-Address.html#Setting-Address">Setting Address</a>) |
| should permit reuse of local addresses for this socket. If you enable |
| this option, you can actually have two sockets with the same Internet |
| port number; but the system won't allow you to use the two |
| identically-named sockets in a way that would confuse the Internet. The |
| reason for this option is that some higher-level Internet protocols, |
| including FTP, require you to keep reusing the same port number. |
| |
| <p>The value has type <code>int</code>; a nonzero value means “yes”. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_KEEPALIVE</code><dd>This option controls whether the underlying protocol should |
| periodically transmit messages on a connected socket. If the peer |
| fails to respond to these messages, the connection is considered |
| broken. The value has type <code>int</code>; a nonzero value means |
| “yes”. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_DONTROUTE</code><dd>This option controls whether outgoing messages bypass the normal |
| message routing facilities. If set, messages are sent directly to the |
| network interface instead. The value has type <code>int</code>; a nonzero |
| value means “yes”. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_LINGER</code><dd>This option specifies what should happen when the socket of a type |
| that promises reliable delivery still has untransmitted messages when |
| it is closed; see <a href="Closing-a-Socket.html#Closing-a-Socket">Closing a Socket</a>. The value has type |
| <code>struct linger</code>. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <div class="defun"> |
| — Data Type: <b>struct linger</b><var><a name="index-struct-linger-1833"></a></var><br> |
| <blockquote> <p>This structure type has the following members: |
| |
| <dl> |
| <dt><code>int l_onoff</code><dd>This field is interpreted as a boolean. If nonzero, <code>close</code> |
| blocks until the data are transmitted or the timeout period has expired. |
| |
| <br><dt><code>int l_linger</code><dd>This specifies the timeout period, in seconds. |
| </dl> |
| </p></blockquote></div> |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_BROADCAST</code><dd>This option controls whether datagrams may be broadcast from the socket. |
| The value has type <code>int</code>; a nonzero value means “yes”. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_OOBINLINE</code><dd>If this option is set, out-of-band data received on the socket is |
| placed in the normal input queue. This permits it to be read using |
| <code>read</code> or <code>recv</code> without specifying the <code>MSG_OOB</code> |
| flag. See <a href="Out_002dof_002dBand-Data.html#Out_002dof_002dBand-Data">Out-of-Band Data</a>. The value has type <code>int</code>; a |
| nonzero value means “yes”. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_SNDBUF</code><dd>This option gets or sets the size of the output buffer. The value is a |
| <code>size_t</code>, which is the size in bytes. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_RCVBUF</code><dd>This option gets or sets the size of the input buffer. The value is a |
| <code>size_t</code>, which is the size in bytes. |
| |
| <!-- sys/socket.h --> |
| <!-- GNU --> |
| <br><dt><code>SO_STYLE</code><dd><!-- sys/socket.h --> |
| <!-- BSD --> |
| <dt><code>SO_TYPE</code><dd>This option can be used with <code>getsockopt</code> only. It is used to |
| get the socket's communication style. <code>SO_TYPE</code> is the |
| historical name, and <code>SO_STYLE</code> is the preferred name in GNU. |
| The value has type <code>int</code> and its value designates a communication |
| style; see <a href="Communication-Styles.html#Communication-Styles">Communication Styles</a>. |
| |
| <!-- sys/socket.h --> |
| <!-- BSD --> |
| <br><dt><code>SO_ERROR</code><dd><!-- Extra blank line here makes the table look better. --> |
| |
| <p>This option can be used with <code>getsockopt</code> only. It is used to reset |
| the error status of the socket. The value is an <code>int</code>, which represents |
| the previous error status. |
| <!-- !!! what is "socket error status"? this is never defined. --> |
| </dl> |
| |
| </body></html> |
| |