Exemplo n.º 1
0
    def __init__(self,ip="",port=prc.DEFAULT_PORT):
        from comm import server_factory
        from comm import CommServerException
        import threading

        try: self._comm_server = server_factory(ip,port,request_handler,PRCSocketServer)
        except CommServerException as error: raise PRCServerException(error)

        self._comm_server_thread = threading.Thread(target=self._comm_server.serve_forever)
        self._comm_server_thread.daemon = True
Exemplo n.º 2
0
        Nothing
    """
    from comm import CommException

    try:
        recv_frame = request.receive()
    except CommException as error:
        print error
        request.close()
        return

    print "Received"

    try:
        request.send("a")
    except CommException as error:
        print error
    finally:
        request.close()



if __name__ == "__main__":
    comm_server = server_factory(ip,port,request_handler)

    comm_server_thread = threading.Thread(target=comm_server.serve_forever)
    comm_server_thread.daemon = True
    comm_server_thread.start()

    while True:
         time.sleep(1)