コード例 #1
0
ファイル: remoteaccess.py プロジェクト: KuanYuChen/mansos
def main():
    try:
        if configuration.c.getCfgValueAsBool("createDaemon"):
            # detach from controlling tty and go to background
            daemon.createDaemon()
        # start the server
        port = configuration.c.getCfgValueAsInt("port")
        server = ThreadingHTTPServer(('', port), HttpServerHandler)
        # load motes
        motes.addAll()
        # start listening thread
        listenThread = threading.Thread(target = listenSerial)
        listenThread.start()
        # report ok and enter the main loop
        print("<remoteaccess>: started, listening to TCP port {}, serial baudrate {}".format(
                port, configuration.c.getCfgValueAsInt("baudrate")))
        server.serve_forever()
    except Exception as e:
        print("<remoteaccess>: exception occurred:")
        print(e)
        print(traceback.format_exc())
        return 1
コード例 #2
0
ファイル: remoteaccess.py プロジェクト: zxpower/MansOS
def main():
    try:
        if configuration.c.getCfgValueAsBool("createDaemon"):
            # detach from controlling tty and go to background
            daemon.createDaemon()
        # start the server
        port = configuration.c.getCfgValueAsInt("port")
        server = ThreadingHTTPServer(('', port), HttpServerHandler)
        # load motes
        motes.addAll()
        # start listening thread
        listenThread = threading.Thread(target=listenSerial)
        listenThread.start()
        # report ok and enter the main loop
        print(
            "<remoteaccess>: started, listening to TCP port {}, serial baudrate {}"
            .format(port, configuration.c.getCfgValueAsInt("baudrate")))
        server.serve_forever()
    except Exception as e:
        print("<remoteaccess>: exception occurred:")
        print(e)
        print(traceback.format_exc())
        return 1
コード例 #3
0
ファイル: mansos_server.py プロジェクト: placidrage/mansos
def main():
    try:
        if configuration.c.getCfgValueAsBool("createDaemon"):
            # detach from controlling tty and go to background
            daemon.createDaemon()
        # load users
        initalizeUsers()
        # start the server
        port = configuration.c.getCfgValueAsInt("port")
        server = ThreadingHTTPServer(('', port), HttpServerHandler)
        # load motes
        motes.addAll()
        # report ok and enter the main loop
        print("<http-server>: started, listening to TCP port {}, serial baudrate {}".format(port,
              configuration.c.getCfgValueAsInt("baudrate")))
        server.serve_forever()
    except SystemExit:
        raise # XXX
    except Exception as e:
        print("<http-server>: exception occurred:")
        print(e)
        print(traceback.format_exc())
        sys.exit(1)
コード例 #4
0
ファイル: mansos_server.py プロジェクト: zxpower/MansOS
def main():
    try:
        configuration.setupPaths()
        if configuration.c.getCfgValueAsBool("createDaemon"):
            # detach from controlling tty and go to background
            daemon.createDaemon()
        # load users
        initalizeUsers()
        # start the server
        port = configuration.c.getCfgValueAsInt("port")
        server = ThreadingHTTPServer(('', port), HttpServerHandler)
        # load motes
        motes.addAll()
        # report ok and enter the main loop
        print("<http-server>: started, listening to TCP port {}, serial baudrate {}".format(port,
              configuration.c.getCfgValueAsInt("baudrate")))
        server.serve_forever()
    except SystemExit:
        raise # XXX
    except Exception as e:
        print("<http-server>: exception occurred:")
        print(e)
        print(traceback.format_exc())
        sys.exit(1)