本文整理汇总了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()
示例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)
示例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")