Beispiel #1
0
client_id = 0
if __name__ == '__main__':
    client_label = "b"
    port = 9001
    print("TCPServer start ......")
    from models.public.headers_model import global_Models
    G = global_Models()
    G.set_map("ServerTime", 0)
    # ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
    # ssl_ctx.load_cert_chain(os.path.join("/home/ssl/", "fullchain.pem"),
    #                         os.path.join("/home/ssl/", "privkey.pem"))
    # TCPServer(ssl_options=ssl_ctx)
    import socket
    from handlers.myredis.redis_class import RedisClass
    R = RedisClass()
    R.register_socketIP(get_host_ip(), port, client_label)
    # R.register_socketIP(socket.gethostbyname(socket.gethostname()), port, client_label)
    # R.register_socketIP("127.0.0.1", port, client_label)

    log_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "log")
    logInit_socket(log_path)
    # server = CopyServer(ssl_options=ssl_ctx)
    server = CopyServer()
    server.listen(port)
    # server.bind(9000)# Forks multiple sub-processes
    # server.start(0)  # Forks multiple sub-processes
    ioloop.IOLoop.current().start()
    # 3.
    # `add_sockets`: advanced
    # multi - process::
    #
Beispiel #2
0
    iplist = ip.split(".")
    client_label = iplist[3]
    print(str(ip))
    port = 9000
    print("TCPServer start ......")
    from models.public.headers_model import global_Models
    G = global_Models()
    G.set_map("ServerTime", 0)
    # ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
    # ssl_ctx.load_cert_chain(os.path.join("/home/ssl/", "fullchain.pem"),
    #                         os.path.join("/home/ssl/", "privkey.pem"))
    # TCPServer(ssl_options=ssl_ctx)

    from handlers.myredis.redis_class import RedisClass
    R = RedisClass()
    R.register_socketIP(ip, port, client_label)
    # R.register_socketIP(socket.gethostbyname(socket.gethostname()), port, client_label)
    # R.register_socketIP("127.0.0.1", port, client_label)
    del R
    log_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "log")
    logInit_socket(log_path)
    # server = CopyServer(ssl_options=ssl_ctx)
    server = CopyServer()
    server.listen(port)
    # server.bind(9000)# Forks multiple sub-processes
    # server.start(0)  # Forks multiple sub-processes
    ioloop.IOLoop.current().start()
    # 3.
    # `add_sockets`: advanced
    # multi - process::
    #