class_docstr: Simple single-threaded server that just pumps around one transport.
class_docstr_tok: ["Simple","single-threaded","server","that","just","pumps","around","one","transport","."]
code: def serve(self):
      self.serverTransport.listen()
      while True:
          client = self.serverTransport.accept()
          if not client:
              continue
  
          itrans = self.inputTransportFactory.getTransport(client)
          iprot = self.inputProtocolFactory.getProtocol(itrans)
  
          # for THeaderProtocol, we must use the same protocol instance for
          # input and output so that the response is in the same dialect that
          # the server detected the request was in.
          if isinstance(
              self.inputProtocolFactory, THeaderProtocolFactory
          ):
              otrans = None
              oprot = iprot
          else:
              otrans = self.outputTransportFactory.getTransport(client)
              oprot = self.outputProtocolFactory.getProtocol(otrans)
  
          try:
              while True:
                  self.processor.process(iprot, oprot)
          except TTransport.TTransportException:
              pass
          except Exception as x:
              logger.exception(x)
  
          itrans.close()
          if otrans:
              otrans.close()
  
imports: from six.moves import queue
  import logging
  import os
  import threading
  from thrift.protocol import TBinaryProtocol
  from thrift.protocol.THeaderProtocol import THeaderProtocolFactory
  from thrift.transport import TTransport
label_desc: Use image node_id 2 for calling the TSimpleServer obj's underlying member method code with example usage: obj.serve() without return types