title: How to set TCP_NODELAY on BSD socket on Solaris?
body: <p>I am trying to turn off Nagle's algorithm for a BSD socket using:</p>
  
  <pre><code>setsockopt(newSock, IPPROTO_TCP, TCP_NODELAY, (char*)&amp;flag, sizeof flag);
  </code></pre>
  
  <p>but the compiler claims <code>TCP_NODELAY</code> hasn't been seen before:</p>
  
  <pre><code>error: `TCP_NODELAY' undeclared (first use this function)
  </code></pre>
  
  <p>This is the full list of includes for the file this is in:</p>
  
  <pre><code>#include &lt;arpa/inet.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;iostream&gt;
  #include &lt;netdb.h&gt;
  #include &lt;string&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;sys/types.h&gt;
  using namespace std;
  </code></pre>
  
  <p>I also have the <code>-lnsl</code> and <code>-lsocket</code> linker options, but it just won't compile. Am I missing something?</p>
  
  <p>All of this is on a Solaris 8 machine.</p>