reactphp / reactphp

Event-driven, non-blocking I/O with PHP.

Home Page:https://reactphp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot bind to IPv6 :: (any address)

maxxer opened this issue · comments

        $loop = \React\EventLoop\Factory::create();
        $ip4 = new \React\Socket\Server($loop);
        $ip6 = new \React\Socket\Server($loop);
        $ip4->listen(9988, '0.0.0.0');
        $ip6->listen(9988, '::');

        $wsStack = new \Ratchet\Http\HttpServer(
            new WsServer(
                new Online()
            )
        );

        $ip4App = new IoServer($wsStack, $ip4, $loop);
        $ip6App = new IoServer($wsStack, $ip6, $loop);
        $loop->run();

This fails with:
Exception 'React\Socket\ConnectionException' with message 'Could not bind to tcp://[::]:9988: Address already in use'

But address is not in use, in fact if I replace :: with the actual machine public IPv6 address works fine.

Thanks for filing this issue 👍 It looks like this is actually an issue in the socket component, may I ask you to file this in https://github.com/reactphp/socket instead? Thanks!