Exemplo n.º 1
0
 def write(self, text):
     try:
         comm = Communicator(gtkserver.REQUEST_PORT)
         comm.open()
         comm.sendObject(text)
         comm.close()
     except:
         pass
Exemplo n.º 2
0
 def close_answer(self, answer):
     try:
         comm = Communicator(answer.port)
         comm.open()
         comm.sendObject("die!")
         comm.close()
     except Exception, error:
         sys.stderr.write("%d\n%s\n%s\n" % (self.request_port, traceback(error), error))
Exemplo n.º 3
0
 def display_report(cls):
     try:
         import inspect
         frame = inspect.currentframe().f_back.f_back.f_back
         info = inspect.getframeinfo(frame)
         framestr = "%s" % str(info)
         comm = Communicator(cls.port)
         comm.open()
         comm.sendObject(framestr)
         comm.close()
     except Exception, error:
         sys.stderr.write("%s\n" % error)
Exemplo n.º 4
0
 def run(self, obj):
     answer = self.answer_t()
     comm = Communicator(self.request_port)
     try:
         comm.open()
         answer.start()
         time.sleep(1)
         comm.sendObject(obj)
     except SocketOpenError, error:
         sys.stderr.write("%d\n%s\n%s\n" % (self.request_port, traceback(error), error))
         self.close_answer(answer)
         return #thread is already dead
Exemplo n.º 5
0
    def run(self):
        while 1:
            ret = ""
            try:
                obj = self.server.acceptObject()
                if isinstance(obj, ServerStop): #end
                    self.stop()
                    return

                ret = self.process(obj)
            except SocketDie:
                return
            except Exception, error:
                sys.stderr.write("%s\n%s\n" % (traceback(error), error))


            try:
                if self.answer_port:
                    comm = Communicator(self.answer_port)
                    comm.open()
                    comm.sendObject(ret)
                    comm.close()
            except SocketOpenError, error:
                sys.stderr.write("%d\n%s\n%s\n" % (self.answer_port, traceback(error), error))
Exemplo n.º 6
0
 def stop(self):
     comm = Communicator(self.server.request_port)
     comm.open()
     comm.sendObject(ServerStop())
     comm.close()
     self.thr.join()