Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Strictly speaking, you don't need any of these socket options:</p> <pre><code>* SO_LINGER </code></pre> <p>You need to set <code>SO_LINGER</code> only if your application still has outstanding packets to send when <code>close(2)</code> or <code>shutdown(2)</code> has been called. Not really applicable for your application.</p> <pre><code>* SO_KEEPALIVE </code></pre> <p>Sending keepalive-pings every two hours would really only help very long-lived but -very- quiet connections going through stateful firewalls with very long session timeouts. (Two hours between pings is entirely too long to be practical in today's Internet.)</p> <pre><code>* SO_NODELAY </code></pre> <p>This (presumably an alias for TCP_NODELAY) disables <a href="http://en.wikipedia.org/wiki/Nagle&#39;s_algorithm" rel="noreferrer">Nagle's algorithm</a>, which is just a small-packet-avoidance problem. Perhaps Nagle is getting in the way in your application, but it takes special sequences of packets to introduce 500ms delays into processing; it never just hangs connections.</p> <pre><code>* SO_REUSEADDRESS </code></pre> <p>Useful for all 'servers' that listen on well-known port numbers; use on 'clients' is almost always covering up some bug or other, but it is sometimes necessary if requests must come from a well-known port number.</p> <pre><code>* SO_SENDBUFFER * SO_RECBUFFER </code></pre> <p>These buffer sizes influence the kernel-side buffer sizes maintained for receiving or sending data while your program (receive buffer) or the socket (send buffer) isn't yet ready to accept more data. If these are set too small, your application might not transfer data as smoothly as possible, reducing throughput, but it should not lead to any stalls if these are set smaller than optimal. Of course, too large may put unreasonable demands on kernel memory, but there should be a reasonable system-wide maximum allowed size.</p> <pre><code>* TCP_NODELAY </code></pre> <p>Disables Nagle. Not likely to do more than introduce 500ms delays if your application sends multiple small packets before attempting a blocking read.</p> <p>Really, you shouldn't need to set any socket options.</p> <p>Can you distill your code into something that could be pasted here and tested or inspected? I'm used to TCP sessions surviving for days or weeks without trouble, so this is pretty surprising.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload