title: Sending and receiving OOB data through a TCP connection using POCO C++
body: <p>I need to develop a TCP server capable of receiving periodic urgent out-of-bounds data. I am using the POCO C++ libraries to achieve this. In the (scarce) documentation of the <a href="http://www.appinf.com/docs/poco/Poco.Net.StreamSocket.html" rel="nofollow">StreamSocket</a> class, I see that this should be a very easy task to achieve: it should be done by setting the SO_OOBINLINE flag when using the receiveBytes() method like so:</p>
  
  <pre><code>n = ss.receiveBytes( buffer, sizeof(buffer), SO_OOBINLINE );
  </code></pre>
  
  <p>To test this, I made a very simple TCP client (also using the POCO libraries) which uses the "sendUrgent()" method to send the OOB data (a single byte):</p>
  
  <pre><code>ss1.sendUrgent( 0xFF );
  </code></pre>
  
  <p>When I send the OOB data, nothing happens. The server doesn't seem to notice it.</p>
  
  <p>On the other hand, when I send "normal" data, using the sendBytes() method, if the SO_OOBINLINE flag is set on the StreamSocket, I receive an infinite amount of the same sent data (it keeps reading the same data although nobody is resending it).</p>
  
  <p>What am I missing?</p>
  
  <p><strong>Edit</strong>: After @JimR's suggestion and reading <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzab6/rzab6coobd.htm" rel="nofollow">this</a>, I have tried:</p>
  
  <pre><code>n = ss.receiveBytes( buffer, sizeof(buffer), MSG_OOB );
  </code></pre>
  
  <p>And even this:</p>
  
  <pre><code>n = ss.receiveBytes( buffer, sizeof(buffer), SO_OOBINLINE | MSG_OOB );
  </code></pre>
  
  <p>Both raise the same exception: Invalid argument.</p>