title: Reading all the data from a UDP socket
body: <h2>Situation:</h2>
  
  <p>I have a sendersocket which is bound to localhost UDP port 33100.
  I have a receiversocket socket bound to localhost UDP port 33101.</p>
  
  <p>The sender socket sends 4500 bytes of data (the string "hello man" * 500). On the receiver side, I have an epoll object which waits for the EPOLLIN event on the receiversocket. When there's an event, I do:</p>
  
  <pre><code>while True:
      msg_received = receiver_socket.recv(128)
      if msg_received.decode("UTF-8") == "":
          break
      else:
          print msg_received.decode("UTF-8")
  </code></pre>
  
  <h2>Problem:</h2>
  
  <p>The <em>main</em> problem is that I cannot read again after I have read the first 128 bytes of data. The sender side says it sent 4500 bytes of data as expected.</p>
  
  <p>If the sender sends the same 4500 bytes of data again, the EPOLLIN event is registered again and I read the new string. Somehow, the buffer get's cleared after my first read.</p>
  
  <p>Now even though the sender just sent me 4500 bytes of data, the first <code>recv</code> gives me 128 bytes of data and then nothing is <code>recv</code>ed after that.</p>
  
  <p>I am probably doing something really stupid so please enlighten me. I want to receive all the 4500 bytes of data.</p>