title: Peeking at a UDP message in c++
body: <p><br>
  I'm trying to receive a UDP message using sockets in c++.<br>
  I'm sending the size of the message in the header, so I can know how much memory should I allocate, so I try to peek at the beggining of the message like this:  </p>
  
  <pre><code>int bytesRead = recvfrom(m_socketId, (char*)&amp;header, Message::HeaderSize, MSG_PEEK, (struct sockaddr *)&amp;fromAddr, &amp;addrSize);  
  </code></pre>
  
  <p>but I keep getting system error 10040 :  </p>
  
  <blockquote>
    <p>"A message sent on a datagram socket
    was larger than the internal message
    buffer or some other network limit, or
    the buffer used to receive a datagram
    into was smaller than the datagram
    itself."</p>
  </blockquote>
  
  <p>Is there a way to peek just at the begging of the message?<br>
  thanks :) </p>