title: Socket. How to receive all data with socket.recv()?
body: <p>I have a problem with receiving data from server to client. I have the following client-side function that attempts to receive data from the server. The data sent by the server using the <code>socket.sendall (data)</code> function is greater than <code>buff_size</code> so I need a loop to read all the data.</p>
  
  <pre><code>def receiveAll (sock):
      data = ""
      buff_size = 4096
      while True: 
         part = sock.recv (buff_size)
         data + = part
         if part &lt;buff_size:
            break;
      return data
  </code></pre>
  
  <p>The problem that occurs to me is that after the first iteration (read the first 4096mb), in the second the program is blocked waiting for the other data in <code>part = sock.recv (buff_size)</code>. How do I have to do so that <code>recv()</code> can continue reading the other missing data? Thank you.</p>