绑定ZMQ:地址已被使用失败

时间:2018-11-20 04:24:30

标签: php zeromq ratchet

我正在尝试初始化服务器以使用Ratchet库监听连接。

我正在关注此link

public function run()
{
    $loop   = Factory::create();
    $pusher = new Pusher;

    // Listen for the web server to make a ZeroMQ push after an ajax request
    $context = new Context($loop);
    $pull = $context->getSocket(ZMQ::SOCKET_PULL);
    $pull->bind('tcp://127.0.0.1:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself
    $pull->on('message', array($pusher, 'onBlogEntry'));

    // Set up our WebSocket server for clients wanting real-time updates
    $webSock = new Server('0.0.0.0:8080', $loop); // Binding to 0.0.0.0 means remotes can connect
    $webServer = new IoServer(
        new HttpServer(
            new WsServer(
                new WampServer(
                    $pusher
                )
            )
        ),
        $webSock
    );

    $loop->run();
}

在部署到服务器时,每次尝试调用此方法时都会出现此错误。

自昨天(这是我最后一次运行此方法)以来,该方法似乎仍在运行并阻塞了端口。

0 个答案:

没有答案