Beispiel #1
0
class VisionServer(object):
    def __init__(self):
        # Private data members
        self._serverThread = None
        self._recv_q = None
        self._send_q = None
        self._netDispatchThread = None
        self._setupNetworkDispatcher()


    def _setupNetworkDispatcher(self):
        self._serverThread = ServerThread(port = 30000)
        self._recv_q = self._serverThread.getRequestQueue()
        self._send_q = self._serverThread.getResponseQueue()
        self._netDispatchThread = SketchResponseThread(self._recv_q, self._send_q)
        self._netDispatchThread.start()
        self._serverThread.start()

    def run(self):
        """Reset the board and wait for some entity to add strokes to the strokeQueue. 
        Add these strokes to the board, and build the xml view of the board, then queue the
        response to send back"""
        while True:
            action = raw_input()
            if action.strip().upper() == "C":
                self._serverThread.stop()
                self._serverThread.join()
                break
            else:
                print "unknown action"