summaryrefslogtreecommitdiff
path: root/man/v1.6.0/nn_getsockopt.3compat.html
diff options
context:
space:
mode:
authorStaysail Systems, Inc <info@staysail.tech>2023-11-26 13:06:39 -0800
committerGarrett D'Amore <garrett@damore.org>2023-11-26 13:07:27 -0800
commit3ec5c9995f9c5611292bd18211fce9402efcb663 (patch)
tree8b405f48024e1fcd047aa47e4d364c178570cf8f /man/v1.6.0/nn_getsockopt.3compat.html
parent2b5c463857370e37f6989d95ec94e99aefd13062 (diff)
downloadnng-3ec5c9995f9c5611292bd18211fce9402efcb663.tar.gz
nng-3ec5c9995f9c5611292bd18211fce9402efcb663.tar.bz2
nng-3ec5c9995f9c5611292bd18211fce9402efcb663.zip
v1.6.0 docs
Diffstat (limited to 'man/v1.6.0/nn_getsockopt.3compat.html')
-rw-r--r--man/v1.6.0/nn_getsockopt.3compat.html464
1 files changed, 464 insertions, 0 deletions
diff --git a/man/v1.6.0/nn_getsockopt.3compat.html b/man/v1.6.0/nn_getsockopt.3compat.html
new file mode 100644
index 00000000..055848bf
--- /dev/null
+++ b/man/v1.6.0/nn_getsockopt.3compat.html
@@ -0,0 +1,464 @@
+---
+version: v1.6.0
+layout: manpage_v2
+title: nn_getsockopt(3compat)
+---
+<h1>nn_getsockopt(3compat)</h1>
+<div class="sect1">
+<h2 id="_name">NAME</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>nn_getsockopt - get socket option (compatible API)</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_synopsis">SYNOPSIS</h2>
+<div class="sectionbody">
+<div class="listingblock">
+<div class="content">
+<pre class="pygments highlight"><code data-lang="c"><span class="tok-cp">#include</span> <span class="tok-cpf">&lt;nanomsg/nn.h&gt;</span>
+
+<span class="tok-kt">int</span> <span class="tok-nf">nn_getsockopt</span><span class="tok-p">(</span><span class="tok-kt">int</span> <span class="tok-n">sock</span><span class="tok-p">,</span> <span class="tok-kt">int</span> <span class="tok-n">level</span><span class="tok-p">,</span> <span class="tok-kt">int</span> <span class="tok-n">option</span><span class="tok-p">,</span> <span class="tok-kt">void</span> <span class="tok-o">*</span><span class="tok-n">val</span><span class="tok-p">,</span> <span class="tok-kt">size_t</span> <span class="tok-o">*</span><span class="tok-n">szp</span><span class="tok-p">);</span></code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_description">DESCRIPTION</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The <code>nn_getsockopt()</code> function gets a socket option on socket <em>sock</em>.
+The option retrieved is determined by the <em>level</em> and <em>option</em>.</p>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+This function is provided for API
+<a href="nng_compat.3compat.html">compatibility</a> with legacy <em>libnanomsg</em>.
+Consider using the relevant <a href="libnng.3.html">modern API</a> instead.
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>The value pointed to by <em>szp</em> must be initialized to the size of the buffer
+pointed to by <em>val</em>.
+No more than this many bytes of the option will be copied into the destination
+buffer on success.
+On success, the value pointed to by <em>szp</em> will be updated with the actual
+size of the option.</p>
+</div>
+<div class="admonitionblock tip">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-tip" title="Tip"></i>
+</td>
+<td class="content">
+To determine the size to receive an option, first call this function
+with <em>val</em> set to <code>NULL</code> and the value addressed by <em>szp</em> initialized to zero.
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>The <em>level</em> determines whether the option is a generic socket option,
+or is transport-specific.
+The values possible for level are as follows:</p>
+</div>
+<div class="hdlist">
+<table>
+<tr>
+<td class="hdlist1">
+<code>NN_SOL_SOCKET</code>
+</td>
+<td class="hdlist2">
+<p>Generic socket option</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>NN_IPC</code>
+</td>
+<td class="hdlist2">
+<p>Transport specific option for IPC.</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>NN_TCP</code>
+</td>
+<td class="hdlist2">
+<p>Transport specific option for TCP.</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>NN_WS</code>
+</td>
+<td class="hdlist2">
+<p>Transport specific option for WebSocket.</p>
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>The following generic socket options are possible (all are of type <code>int</code> and
+thus size 4, unless otherwise indicated.)</p>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_SNDBUF</code></dt>
+<dd>
+<p>Send buffer size in bytes.</p>
+</dd>
+</dl>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+In <em>NNG</em> buffers are sized as a count of messages rather than
+bytes; accordingly this value is the queue depth multiplied by 1024
+(representing an estimate that the average message size is 1kB).
+Applications that have unusual message sizes may wish to adjust the value
+used here accordingly.
+</td>
+</tr>
+</table>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_RCVBUF</code></dt>
+<dd>
+<p>Receive buffer size in bytes.</p>
+</dd>
+</dl>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+The same caveats for <code>NN_SNDBUF</code> apply here as well.
+</td>
+</tr>
+</table>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_SNDTIMEO</code></dt>
+<dd>
+<p>Send time-out in milliseconds.
+Send operations will fail with <code>ETIMEDOUT</code> if no message can be received
+after this many milliseconds have transpired since the operation was started.
+A value of -1 means that no timeout is applied.</p>
+</dd>
+<dt class="hdlist1"><code>NN_RCVTIMEO</code></dt>
+<dd>
+<p>Receive time-out in milliseconds.
+Receive operations will fail with <code>ETIMEDOUT</code> if no message can be received
+after this many milliseconds have transpired since the operation was started.
+A value of -1 means that no timeout is applied.</p>
+</dd>
+<dt class="hdlist1"><code>NN_RCVMAXSIZE</code></dt>
+<dd>
+<p>Maximum receive size in bytes.
+The socket will discard messages larger than this on receive.
+The default, 1MB, is intended to prevent denial-of-service attacks.
+The value -1 removes any limit.</p>
+</dd>
+<dt class="hdlist1"><code>NN_RECONNECT_IVL</code></dt>
+<dd>
+<p>Reconnect interval in milliseconds.
+After an outgoing connection is closed or fails, the socket will
+automatically attempt to reconnect after this many milliseconds.
+This is the starting value for the time, and is used in the first
+reconnection attempt after a successful connection is made.
+The default is 100.</p>
+</dd>
+<dt class="hdlist1"><code>NN_RECONNECT_IVL_MAX</code></dt>
+<dd>
+<p>Maximum reconnect interval in milliseconds.
+Subsequent reconnection attempts after a failed attempt are made at
+exponentially increasing intervals (back-off), but the interval is
+capped by this value.
+If this value is smaller than <code>NN_RECONNECT_IVL</code>, then no exponential
+back-off is performed, and each reconnect interval will be determined
+solely by <code>NN_RECONNECT_IVL</code>.
+The default is zero.</p>
+</dd>
+<dt class="hdlist1"><code>NN_LINGER</code></dt>
+<dd>
+<p>This option is always zero and exists only for compatibility.</p>
+</dd>
+</dl>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+This option was unreliable in early releases of <em>libnanomsg</em>, and
+is unsupported in <em>NNG</em> and recent <em>libnanomsg</em> releases.
+Applications needing assurance of message delivery should either include an
+explicit notification (automatic with the <code>NN_REQ</code> protocol) or allow
+sufficient time for the socket to drain before closing the socket or exiting.
+</td>
+</tr>
+</table>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_SNDPRIO</code></dt>
+<dd>
+<p>This option is not implemented at this time.</p>
+</dd>
+<dt class="hdlist1"><code>NN_RCVPRIO</code></dt>
+<dd>
+<p>This option is not implemented at this time.</p>
+</dd>
+<dt class="hdlist1"><code>NN_IPV4ONLY</code></dt>
+<dd>
+<p>This option is not implemented at this time.</p>
+</dd>
+<dt class="hdlist1"><code>NN_SOCKET_NAME</code></dt>
+<dd>
+<p>This option is a string, and represents the socket name.
+It can be changed to help with identifying different sockets with
+their different application-specific purposes.</p>
+</dd>
+<dt class="hdlist1"><code>NN_MAXTTL</code></dt>
+<dd>
+<p>Maximum number of times a message may traverse devices or proxies.
+This value, if positive, provides some protection against forwarding loops in
+<a href="nng_device.3.html">device</a> chains.</p>
+</dd>
+</dl>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+Not all protocols offer this protection, so care should still be used
+in configuring device forwarding.
+</td>
+</tr>
+</table>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_DOMAIN</code></dt>
+<dd>
+<p>This option of type <code>int</code> represents either the value <code>AF_SP</code> or <code>AF_SP_RAW</code>,
+corresponding to the value that the socket was created with.</p>
+</dd>
+<dt class="hdlist1"><code>NN_PROTOCOL</code></dt>
+<dd>
+<p>This option option of type <code>int</code> contains the numeric protocol number
+that the socket is used with.</p>
+</dd>
+<dt class="hdlist1"><code>NN_RCVFD</code></dt>
+<dd>
+<p>This option returns a file descriptor suitable for use in with <code>poll()</code> or
+<code>select()</code> (or other system-specific polling functions).
+This descriptor will be readable when a message is available for receiving
+at the socket.
+This option is of type <code>int</code> on all systems except Windows, where it is of
+type <code>SOCKET</code>.</p>
+</dd>
+</dl>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+The file descriptor should not be read or written by the application,
+and is not the same as any underlying descriptor used for network sockets.
+</td>
+</tr>
+</table>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_SNDFD</code></dt>
+<dd>
+<p>This option returns a file descriptor suitable for use in with <code>poll()</code> or
+<code>select()</code> (or other system-specific polling functions).
+This descriptor will be readable when the socket is able to accept a message
+for sending.
+This option is of type <code>int</code> on all systems except Windows, where it is of
+type <code>SOCKET</code>.</p>
+</dd>
+</dl>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+The file descriptor should not be read or written by the application,
+and is not the same as any underlying descriptor used for network sockets.
+Furthermore, the file descriptor should only be polled for <em>readability</em>.
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>The following option is available for <code>NN_REQ</code> sockets
+using the <code>NN_REQ</code> level:</p>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_REQ_RESEND_IVL</code></dt>
+<dd>
+<p>Request retry interval in milliseconds.
+If an <code>NN_REQ</code> socket does not receive a reply to a request within this
+period of time, the socket will automatically resend the request.
+The default value is 60000 (one minute).</p>
+</dd>
+</dl>
+</div>
+<div class="paragraph">
+<p>The following option is available for <code>NN_SURVEYOR</code> sockets
+using the <code>NN_SURVEYOR</code> level:</p>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_SURVEYOR_DEADLINE</code></dt>
+<dd>
+<p>Survey deadline in milliseconds for <code>NN_SURVEYOR</code> sockets.
+After sending a survey message, the socket will only accept responses
+from respondents for this long.
+Any responses arriving after this expires are silently discarded.</p>
+</dd>
+</dl>
+</div>
+<div class="paragraph">
+<p>In addition, the following transport specific options are offered:</p>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>NN_IPC_SEC_ATTR</code></dt>
+<dd>
+<p>This <code>NN_IPC</code> option is not supported at this time.</p>
+</dd>
+<dt class="hdlist1"><code>NN_IPC_OUTBUFSZ</code></dt>
+<dd>
+<p>This <code>NN_IPC</code> option is not supported at this time.</p>
+</dd>
+<dt class="hdlist1"><code>NN_IPC_INBUFSZE</code></dt>
+<dd>
+<p>This <code>NN_IPC</code> option is not supported at this time.</p>
+</dd>
+<dt class="hdlist1"><code>NN_TCP_NODELAY</code></dt>
+<dd>
+<p>This <code>NN_TCP</code> option is not supported at this time.</p>
+</dd>
+<dt class="hdlist1"><code>NN_WS_MSG_TYPE</code></dt>
+<dd>
+<p>This <code>NN_WS</code> option is not supported, as <em>NNG</em> only supports binary messages
+in this implementation.</p>
+</dd>
+</dl>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_return_values">RETURN VALUES</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This function returns zero on success, and -1 on failure.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_errors">ERRORS</h2>
+<div class="sectionbody">
+<div class="hdlist">
+<table>
+<tr>
+<td class="hdlist1">
+<code>EBADF</code>
+</td>
+<td class="hdlist2">
+<p>The socket <em>sock</em> is not an open socket.</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>ENOMEM</code>
+</td>
+<td class="hdlist2">
+<p>Insufficient memory is available.</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>ENOPROTOOPT</code>
+</td>
+<td class="hdlist2">
+<p>The level and/or option is invalid.</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>EINVAL</code>
+</td>
+<td class="hdlist2">
+<p>The option, or the value passed, is invalid.</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>ETERM</code>
+</td>
+<td class="hdlist2">
+<p>The library is shutting down.</p>
+</td>
+</tr>
+<tr>
+<td class="hdlist1">
+<code>EACCES</code>
+</td>
+<td class="hdlist2">
+<p>The option cannot be changed.</p>
+</td>
+</tr>
+</table>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_see_also">SEE ALSO</h2>
+<div class="sectionbody">
+<div class="paragraph text-left">
+<p><a href="nng_socket.5.html">nng_socket(5)</a>,
+<a href="nn_close.3compat.html">nn_close(3compat)</a>,
+<a href="nn_errno.3compat.html">nn_errno(3compat)</a>,
+<a href="nn_getsockopt.3compat.html">nn_getsockopt(3compat)</a>,
+<a href="nng_compat.3compat.html">nng_compat(3compat)</a>,
+<a href="nng.7.html">nng(7)</a></p>
+</div>
+</div>
+</div>