NotionCommotion Posted May 24, 2017 Share Posted May 24, 2017 Finally bit the bullet and migrated to PHP7 as well as Centos7. Unfortunately, remote clients can no longer connect to my sockets server. A client running on the same machine, however, can connect using both 1.2.3.4:1337 as well as 1.2.3.4:1337 (where 1.2.3.4 is the server's IP). I've disabled the firewall just in case, but still cannot connect. Originally, I was using SSL, but I stripped that all off, and am just using TCP. I don't know if it is related, but the server doesn't respond to pings unless made from its machine, however, Apache will respond to curl 1.2.3.4. What should I investigate? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/304008-why-does-socket-server-no-longer-accept-remote-connections/ Share on other sites More sharing options...
NotionCommotion Posted May 24, 2017 Author Share Posted May 24, 2017 (edited) EDIT. I just found out I can connect on port 80. Why just port 80? If it helps, this is my test script. The client can only connect when run on the same machine. <?php $host='0.0.0.0:1337'; error_reporting(E_ALL); ini_set('display_startup_errors', 1); ini_set('display_errors', 1); openlog('API', LOG_NDELAY, LOG_LOCAL2); require '../../vendor/autoload.php'; $loop = \React\EventLoop\Factory::create(); $server = new \React\Socket\TcpServer($host, $loop); $server->on('connection', function (\React\Socket\ConnectionInterface $conn) { syslog(LOG_INFO,"onConnect"); $conn->on('data', function($data) { syslog(LOG_INFO,"onData"); var_dump($data); }); $conn->on('error', function($error, $conn) { syslog(LOG_INFO,"onError"); var_dump($error); }); $conn->on('close', function() { syslog(LOG_INFO,"onClose"); }); }); $server->on('error', function($error) use ($loop){ $this->logError('onServerError: '.$error->getMessage(), $data); //$loop->stop(); }); $loop->run(); <?php $host='1.2.3.4:1337'; error_reporting(E_ALL); ini_set('display_startup_errors', 1); ini_set('display_errors', 1); openlog('API', LOG_NDELAY, LOG_LOCAL2); require '../../vendor/autoload.php'; $loop = \React\EventLoop\Factory::create(); $connector = new \React\Socket\TimeoutConnector(new \React\Socket\Connector($loop), 5, $loop); $connector->connect($host) ->then(function (\React\Socket\ConnectionInterface $conn) use ($loop) { syslog(LOG_INFO,"onConnect"); $conn->on('data', function($data) { syslog(LOG_INFO,"onData"); var_dump($data); }); $conn->on('error', function($error, $conn) { syslog(LOG_INFO,"onError"); var_dump($error); }); $conn->on('close', function() { syslog(LOG_INFO,"onClose"); }); })->otherwise(function(\RuntimeException $error) use(&$response, $loop){ syslog(LOG_INFO,"onTimeout"); }); $loop->run(); Edited May 24, 2017 by NotionCommotion Quote Link to comment https://forums.phpfreaks.com/topic/304008-why-does-socket-server-no-longer-accept-remote-connections/#findComment-1546792 Share on other sites More sharing options...
Solution kicken Posted May 25, 2017 Solution Share Posted May 25, 2017 Your symptoms all point to a firewall blocking traffic. Sounds like you didn't disable it properly or perhaps you have a second one somewhere. Quote Link to comment https://forums.phpfreaks.com/topic/304008-why-does-socket-server-no-longer-accept-remote-connections/#findComment-1546794 Share on other sites More sharing options...
NotionCommotion Posted May 25, 2017 Author Share Posted May 25, 2017 Maybe selinux? Quote Link to comment https://forums.phpfreaks.com/topic/304008-why-does-socket-server-no-longer-accept-remote-connections/#findComment-1546795 Share on other sites More sharing options...
NotionCommotion Posted May 25, 2017 Author Share Posted May 25, 2017 Bummer It is a 1&1 vps. Maybe they have a hardware firewall? I will call them. SELinux status: disabled Quote Link to comment https://forums.phpfreaks.com/topic/304008-why-does-socket-server-no-longer-accept-remote-connections/#findComment-1546796 Share on other sites More sharing options...
NotionCommotion Posted May 25, 2017 Author Share Posted May 25, 2017 You were right! Another firewall. Quote Link to comment https://forums.phpfreaks.com/topic/304008-why-does-socket-server-no-longer-accept-remote-connections/#findComment-1546797 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.