D
D
dodickoff2019-12-15 19:12:33
PHP
dodickoff, 2019-12-15 19:12:33

What is the correct way to open a listening port through ReactPHP?

Trying to make an app using ReactPHP/Sosket? so that it can just receive and send messages.
Everything works on local, but when transferring to Yandex, the cloud can’t figure out how to open the port correctly so that it is accessible from the outside.
It seems that I tried all the instructions: first on ubuntu, now I switched to centos 7 (I thought it would be easier, but no).
In the connection settings, I specify my external ip and port:

$loop = React\EventLoop\Factory::create();
$server = new React\Socket\Server("1.2.3.4:4321", $loop);
$server = new React\Socket\LimitingServer($server, null);

but when I run it from the console, I get this:
Fatal error: Uncaught RuntimeException: Failed to listen on "tcp://1.2.3.4:4321": Cannot assign requested address in /path/to/dir/vendor/react/socket/src/TcpServer.php:164

I understand that the error is most likely in the wrong server configuration, but I have already tried a bunch of options and everything is useless (configured through iptables and ufw).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kubintsev, 2019-12-25
@akubintsev

Address 0.0.0.0:4321 tried?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question