title: How to check if all data are received with a TCP Socket in Python
body: <p>I am trying to get data from a TCP Connection (client side only) using Python as programming language,</p>
  
  <p>However, I could see that all data are not received in once and are cut in the middle of the receiving process ... I could see on forums that TCP does not send data in the correct order (it is a bit random, link: <a href="https://stackoverflow.com/questions/1708835/receving-socket-python">Python socket receive - incoming packets always have a different size</a>), am I wrong ?</p>
  
  <p>My question is if there is anyway to make sure that I correctly received all data?</p>
  
  <p>Thanks in advance for your help and replies,</p>
  
  <p>PS: I already increased the buffer size of socket.recv(), but still facing the same issue ... And I am only working under CentOS</p>
  
  <p>EDIT: (couldn't reply to my own question :( Still beginner on this forum :) )  </p>
  
  <p>Hi,</p>
  
  <p>Thanks a lot for your reply, indeed I don't have to worry about the TCP connection :) </p>
  
  <p>After investigating more, I could finally find the solution ... (I was searching for a few days before posting my question here),</p>
  
  <p>If anyone needs an answer, in python you must wait for the full message, otherwise the message can be cut, so this means:</p>
  
  <p>data = s.recv(1024, socket.MSG_WAITALL) --> 's' is a socket object created in the python code,</p>
  
  <p>Kind regards</p>