title: How to programmatically find the socket waiting queue size of my computer?
body: <p>I want to programmatically find the size of the socket waiting queue of my computer i.e. the number of socket that can be put in the queue before being refused (while the server is listening for clients).</p>
  
  <p>On the server side, I simply create a socket, bind it, listen and enter in an infinite loop in order to wait client sockets.<br>
  Then I thought that this little script would help me to find the queue size:</p>
  
  <pre><code>pids=""
  for i in {1..8}; do
       netcat localhost -w 3 19677 &amp;
       pids+=" $!"
  done
  
  for p in $pids; do
          if wait $p; then
                  echo "Process $p success"
         else
                  echo "Process $p fail"
          fi
  done
  </code></pre>
  
  <p>If there is more than 4 rounds in the loop then I always get a timeout exception,(and never for 4 or less) but increasing the number of rounds doesn't always lead to more errors (I don't always get 2 errors for 6 rounds, 3 for 7, etc.). Why?</p>
  
  <p>Moreover, if I launch netcat directly in 5 terminals (<code>netcat localhost -w 5 19677</code>), I don't get any error.</p>
  
  <p>What am I missing?</p>