title: Python Linux Netlink Recv Buffer
body: <p>When I create a try to <code>socket.recv()</code> from a NETLINK_ROUTE socket if I don't recv ALL the data available, it seems the data not recv'd is lost.</p>
  
  <p>For example:</p>
  
  <pre><code>&gt;&gt;&gt; import socket
  &gt;&gt;&gt; sock = socket.socket(socket.AF_NETLINK, socket.SOCK_DGRAM, socket.NETLINK_ROUTE)
  &gt;&gt;&gt; sock.bind((0,0))
  &gt;&gt;&gt; sock.send('\24\0\0\0\22\0\1\3\23\0364O\0\0\0\0\21\0\0\0') # struct nlmsghdr
  20
  &gt;&gt;&gt; sock.recv(10000)
  '\xe4\x03\x00\x00 ... ' (+3000 more bytes)
  </code></pre>
  
  <p>If I <code>sock.recv(100)</code>, it will return 100 bytes but the +2900 other bytes are gone.  Doing another <code>sock.recv()</code> will return the next nlmsghdr (if a multi part message) or block waiting for data.</p>
  
  <p>I can <code>sock.recv(X, socket.MSG_PEEK)</code> to read X bytes without data being lost; but when doing that the read data isn't pop'd out of the recv buffer of course.</p>
  
  <p>I thought any data not read would remain in the buffer until read. What am I doing wrong?  I'd rather not just 'guess' at how much data might be available...</p>