title: TCP send queue depth
body: <p>How do I discover how many bytes have been sent to a TCP socket but have not yet been put on the wire?</p>
  
  <p>Looking at the diagram here:
  <a href="https://i.stack.imgur.com/pHB5a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pHB5a.png" alt="http://www.tcpipguide.com/free/diagrams/tcpswpointers.png"></a></p>
  
  <p>I would like to know the total of Categories 2, 3, and 4 or the total of 3 and 4.  This is in C(++) and on both Windows and Linux.  Ideally there is a ioctl that I could use, but there doesn't seem to be any.  </p>