当前位置: 首页>>代码示例>>Python>>正文


Python Server.daemon方法代码示例

本文整理汇总了Python中server.Server.daemon方法的典型用法代码示例。如果您正苦于以下问题:Python Server.daemon方法的具体用法?Python Server.daemon怎么用?Python Server.daemon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在server.Server的用法示例。


在下文中一共展示了Server.daemon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import daemon [as 别名]
def main():
    check_os()    
    from server import Server
    print("XMPlay Remote Control Server")
    print("")
    ip = input("Write the listening address(0.0.0.0 by default): ")
    if (ip == ""):
        ip = "0.0.0.0"
        
    port = input("Write the listening port(9999 by default): ")
    if (port == ""):
        port = "9999"
        
    port = int(port)
    
    threadServer = Server(1,(ip,port))
    threadServer.daemon = True
    threadServer.start()
    print("Server Started!")
    while (input("Write exit to quit: ") != "exit"):
        os.system("cls")
        pass
    
    threadServer.stop_server()
    sys.exit()
开发者ID:lucasdaddiego,项目名称:pyremote-xmplay,代码行数:27,代码来源:run.py

示例2: dict

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import daemon [as 别名]
    parser.add_argument("-f", "--launch-script", type=str, default="./config/updatejunkie.json",
                        help="Specify a command script that will be executed at launch")
    verbosity = dict(DEBUG=logging.DEBUG, INFO=logging.INFO, SILENT=100)
    parser.add_argument("-v", "--verbosity", type=str, choices=verbosity.keys(), default="INFO",
                        help="Set verbosity (Default is INFO)")
    args = parser.parse_args()

    # Setup logging
    dtime_format = "%Y-%m-%d %H:%M"
    logging.basicConfig(filename='updatejunkie.log', format='[%(asctime)s] %(message)s', datefmt = dtime_format,
                        level=verbosity[args.verbosity])
    logging.getLogger().addHandler(logging.StreamHandler())

    # Start the engines!
    server = Server()
    server.daemon = True
    server.start()
        
    # Process the launch script
    try:
        config = JsonScript(server, args.launch_script)
        config.run()
    except FileNotFoundError:
        logging.error("Command script not found: {}".format(args.launch_script))

    # Start the web API
    server.start_web_api()

    # Register web client
    client_root = "{}/client/".format(os.path.dirname(os.path.abspath(__file__)))
    server.register_client(client_root)
开发者ID:kolomanschaft,项目名称:updatejunkie,代码行数:33,代码来源:junkie.py

示例3: startServer

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import daemon [as 别名]
def startServer():
	if not serverStarted:
		server = Server()
		server.daemon = True
		server.start()	
		print("Server started")
开发者ID:macleod2486,项目名称:Whisper,代码行数:8,代码来源:client.py


注:本文中的server.Server.daemon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。