code: def handle(self):
          self.logger = self.server.logger
          packet = iis()
          packet.datain = self.rfile
          packet.dataout = self.wfile
          size = struct.calcsize('8h')
          line = packet.datain.read(size)
          n = len(line)
          if n < size:
              return
          while n > 0:
              try:
                  bytes = struct.unpack('8h', line)
              except Exception:
                  self.logger.error('error unpacking the data.')
                  for exctn in sys.exc_info():
                      print(exctn)
              subunit = bytes[2]
              subunit077 = subunit & 0o77
              tid = bytes[0]
              x = bytes[4] & 0o177777
              y = bytes[5] & 0o177777
              z = bytes[6] & 0o177777
              t = bytes[7] & 0o17777
              ndatabytes = - bytes[1]
              if (not(tid & PACKED)):
                  ndatabytes *= 2
              packet.subunit = subunit
              packet.subunit077 = subunit077
              packet.tid = tid
              packet.x = x
              packet.y = y
              packet.z = z
              packet.t = t
              packet.nbytes = ndatabytes
              self.logger.debug("PACKET IS %o" % packet.subunit)
              if packet.subunit077 == FEEDBACK:
                  self.handle_feedback(packet)
              elif packet.subunit077 == LUT:
                  self.handle_lut(packet)
                  line = packet.datain.read(size)
                  n = len(line)
                  continue
              elif packet.subunit077 == MEMORY:
                  self.handle_memory(packet)
                  if self.needs_update:
                      pass
                  line = packet.datain.read(size)
                  n = len(line)
                  continue
              elif packet.subunit077 == WCS:
                  self.handle_wcs(packet)
                  line = packet.datain.read(size)
                  n = len(line)
                  continue
              elif packet.subunit077 == IMCURSOR:
                  self.handle_imcursor(packet)
                  line = packet.datain.read(size)
                  n = len(line)
                  continue
              else:
                  self.logger.debug('?NO OP (0%o)' % (packet.subunit077))
              if not (packet.tid & IIS_READ):
                  nbytes = packet.nbytes
                  while nbytes > 0:
                      if nbytes < SZ_FIFOBUF:
                          n = nbytes
                      else:
                          n = SZ_FIFOBUF
                      m = self.rfile.read(n)
                      if m <= 0:
                          break
                      nbytes -= n
              line = packet.datain.read(size)
              n = len(line)
              if n < size:
                  return
          if self.needs_update:
              self.display_image()
              self.needs_update = False