title: Sockets error when different device is connected to the server
body: <p>I was making a game and decided to see if I could connect to the server that was running on my machine on a different machine. I compiled the code on my machine (with pyinstaller) and then tried running it on the other machine. I worked fine at first but about 30 seconds later, the server stopped sending data to the other machine. I looked in the logs and saw
  <code>Error client_thread: invalid literal for int() with base 10: b' 69, '</code>. I think this means that the other machine is partially sending data, rather than all of the data. This is the client code used to send data:</p>
  <pre><code>ge = {'position update': [player.id, player.x, player.y, player.flip, player.name, player.been_hit],&quot;mini-update&quot;:[hit_player,player.score,start_game]}
  data = json.dumps(ge)
  try:
      self.socket.sendall((f&quot;{len(data):&lt;{HEADER_SIZE}}&quot;+data).encode())
  except socket.error as e:
      print(e)
  </code></pre>
  <p>and this is the code for receiving data:</p>
  <pre><code>data = &quot;&quot;
  recv_data = conn.recv(bufsize)
  if recv_data == b'':
      print(f&quot;{player_id} DISCONNECTED&quot;)
      break
  message_length = int(recv_data[:HEADER_SIZE])
  data += recv_data.decode()
  while True:
      if len(data)-HEADER_SIZE &gt;= message_length:
          if len(data)-HEADER_SIZE &gt; message_length:
              conn.setblocking(0)
              while True:
                  try:
                      extra_data = conn.recv(bufsize)
                      if not extra_data:
                          break
                  except:
                      break
              conn.setblocking(1)
          break
      recv_data = conn.recv(bufsize)
      data += recv_data.decode()
  data = data[HEADER_SIZE:message_length+HEADER_SIZE]
  </code></pre>
  <p>Both of the machines are using Debian 10. Does anyone know why this might be happening?</p>