code: def read_packets(self):
          
          while self.running:
              packet_length = self.client.recv(2)
              if len(packet_length) < 2:
                  self.stop()
                  continue
              packet_length = struct.unpack("<h", packet_length)[0] - 2
  
              data = self.client.recv(packet_length)
              packno = data[0]
  
              try:
                  parser = "Packet" + format(packno, 'x').upper() + "Parser"
                  packet_class = getattr(packets, parser)
                  packet_class().parse(self.world, self.player, data, self._evman)
              except AttributeError as e:
                  pass
  
              if packno == 2:
                  self.stop()
                  continue
docs: Read packets from the socket and parse them