title: What is the effect of setting a linux socket - high priority?
body: <p>From the linux socket <a href="http://linux.die.net/man/7/socket" rel="noreferrer">manpage</a>:    </p>
  
  <blockquote>
    <p>SO_PRIORITY<br>
    Set the protocol-defined priority for all packets to be
    sent on this socket. Linux uses this value to order the networking
    queues: packets with a higher priority may be processed first
    depending on the selected device queueing discipline.</p>
  </blockquote>
  
  <p>And this is set using:   </p>
  
  <pre><code>int optval=7 // valid values are in the range [1,7]  
               // 1- low priority, 7 - high priority  
  setsockopt(socket, SOL_SOCKET, SO_PRIORITY, &amp;optval, optlen)   
  </code></pre>
  
  <p>And say, the process has:<br>
  a. 10 low priority sockets (priority=4) from <code>socket_1</code> - <code>socket_10</code>,<br>
  b. 1 high priority socket (priority=7) - <code>socket_11</code>  </p>
  
  <p>What will happen in the following scenarios:  </p>
  
  <ol>
  <li><p><code>send()</code>: process sends multiple msgs on <code>socket_1</code>-<code>socket_10</code> &amp; on <code>socket_11</code>, IMO msgs on the <code>socket_11</code> will be given preference over the msgs being sent over <code>socket_1</code>-<code>socket_10</code>.  </p></li>
  <li><p><code>recv()</code>: if there are mutilple msgs being received at all the sockets described above, does <code>socket_11</code> gets higher priority in reading the messages over <code>socket_1</code>-<code>socket_10</code> ?  </p></li>
  <li><p>Is there a way to measure the socket priority from command line using tools such as <code>lsof</code>, <code>netstat</code> etc?</p></li>
  </ol>