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


Python SocketIOServer.start方法代码示例

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


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

示例1: socketio_server

# 需要导入模块: from socketio.server import SocketIOServer [as 别名]
# 或者: from socketio.server.SocketIOServer import start [as 别名]
def socketio_server():
    #server = SocketIOServer(('0.0.0.0', 0), SocketApp(), policy_server=False)
    server = SocketIOServer(('0.0.0.0', 38477), SocketApp(), policy_server=False)
    server.start()
    port = server.socket.getsockname()[1]
    print 'http://localhost:'+str(port)+'/'
    server.serve_forever()
开发者ID:bishopZ,项目名称:meditation-deathmatch,代码行数:9,代码来源:standalone-server.py

示例2: socketio_server

# 需要导入模块: from socketio.server import SocketIOServer [as 别名]
# 或者: from socketio.server.SocketIOServer import start [as 别名]
def socketio_server():
    server = SocketIOServer(
        ('0.0.0.0', port),
        SocketApp(),
        policy_server=False)
    server.start()
    server.serve_forever()
开发者ID:bishopZ,项目名称:meditation-deathmatch,代码行数:9,代码来源:qt5-webview.py

示例3: handle

# 需要导入模块: from socketio.server import SocketIOServer [as 别名]
# 或者: from socketio.server.SocketIOServer import start [as 别名]
    def handle(self, addrport="", *args, **options):
        global server
        if not addrport:
            self.addr = ''
            self.port = DEFAULT_PORT
        else:
            m = match(naiveip_re, addrport)
            if m is None:
                raise CommandError('"%s" is not a valid port number '
                                   'or address:port pair.' % addrport)
            self.addr, _, _, _, self.port = m.groups()

        # Make the port available here for the path:
        #   socketio_tags.socketio ->
        #   socketio_scripts.html ->
        #   io.Socket JS constructor
        # allowing the port to be set as the client-side default there.
        environ["DJANGO_SOCKETIO_PORT"] = str(self.port)

        start_new_thread(reload_watcher, ())
        try:
            bind = (self.addr, int(self.port))
            print
            print "SocketIOServer running on %s:%s" % bind
            print
            handler = self.get_handler(*args, **options)
            server = SocketIOServer(bind, handler, resource="socket.io", policy_server=True)
            #server.serve_forever()port
            from gevent.event import Event
            stopper = Event()
            server.start()
            stopper.wait()
        except KeyboardInterrupt:
            if RELOAD:
                server.stop()
                print "Reloading..."
                restart_with_reloader()
            else:
                raise
开发者ID:JeremyBernier,项目名称:gevent-socketio-starterkit,代码行数:41,代码来源:rs.py

示例4: start

# 需要导入模块: from socketio.server import SocketIOServer [as 别名]
# 或者: from socketio.server.SocketIOServer import start [as 别名]
def start(http_host, http_port, smtp_host, smtp_port, db_path=None):
    global socketio_server
    # Webserver
    log.notice('Starting web server on http://{0}:{1}'.format(http_host, http_port))
    socketio_server = SocketIOServer((http_host, http_port), app,
                                     log='default' if app.debug else None)
    socketio_server.start()
    # SMTP server
    log.notice('Starting smtp server on {0}:{1}'.format(smtp_host, smtp_port))
    SMTPServer((smtp_host, smtp_port), smtp_handler)
    gevent.spawn(asyncore.loop)
    # Database
    connect(db_path)
    create_tables()
    # Wait....
    try:
        stopper.wait()
    except KeyboardInterrupt:
        print
    else:
        log.debug('Received stop signal')
    # Clean up
    disconnect()
    log.notice('Terminating')
开发者ID:n3storm,项目名称:maildump,代码行数:26,代码来源:__init__.py

示例5: open

# 需要导入模块: from socketio.server import SocketIOServer [as 别名]
# 或者: from socketio.server.SocketIOServer import start [as 别名]
        nargs="?",
        default="/dev/null",
        const=ROOT + "/log",
    )
    args = parser.parse_args()
    if args.debug is False:
        if args.log == "/dev/null":
            sys.stderr = open(os.devnull, "w")
        else:
            sys.stderr = open(args.log, "w")

    options = {"resource": "socket.io", "policy_server": True, "policy_listener": ("0.0.0.0", 10843)}

    # Start server
    sys.stdout.write(color("Argonaut - ", "cyan"))
    sys.stdout.write(color("Starting server...\n", "blue"))
    sys.stdout.write(color("   Ports - ", "cyan"))
    sys.stdout.write(color("App: ", "blue") + color("6058  ", "red"))
    sys.stdout.write(color("Flash: ", "blue") + color("843\n", "red"))
    sys.stdout.flush()
    server = SocketIOServer(("0.0.0.0", 6058), app, **options)
    server.start()

    # Start server-side prompt
    prompt = color("Argonaut", "cyan") + color("$ ", "blue")
    while True:
        cmd = raw_input(prompt)
        if cmd.startswith("exit"):
            server.stop()
            exit(0)
开发者ID:kestred,项目名称:sandbox,代码行数:32,代码来源:server.py

示例6: socketio_server

# 需要导入模块: from socketio.server import SocketIOServer [as 别名]
# 或者: from socketio.server.SocketIOServer import start [as 别名]
def socketio_server(q):
    server = SocketIOServer(('0.0.0.0', 0), SocketApp(), policy_server=False)
    server.start()
    port = server.socket.getsockname()[1]
    q.put(port)
    server.serve_forever()
开发者ID:wolfspyre,项目名称:meditation-deathmatch,代码行数:8,代码来源:qt-webview.py


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