title: Get the number of bytes available in socket by 'recv' with 'MSG_PEEK' in C++
body: <p>C++ has the following function to receive bytes from socket, it can check for number of bytes available with the <code>MSG_PEEK</code> flag. With <code>MSG_PEEK</code>, the returned value of 'recv' is the number of bytes available in socket:</p>
  
  <pre><code>#include &lt;sys/socket.h&gt;
  ssize_t recv(int socket, void *buffer, size_t length, int flags); 
  </code></pre>
  
  <p>I need to get the number of bytes available in the socket without creating <code>buffer</code> (without allocating memory for <code>buffer</code>). Is it possible and how?</p>