i have a problem with PHP Socket connect on an ubuntu-server with PHP7 behind NAT. I can connect from all devices in local-network (192.168.2.XXX) with telnet. But i cannot connect from external IP from Internet. PORT 5555 is open in firewall and i can see traffic coming in with "tcpdump". but PHP is ignoring this. Here is my code so far:
$port = 5555;
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP) or die("socket_create failed");
socket_bind($socket,'0.0.0.0',$port) or die("socket_bind failed");
socket_listen($socket);
while(true)
{
if(($newc = socket_accept($socket)) !== false)
{
echo "connected ...";
socket_close($newc);
}
}
socket_close($socket);
Thanks ahead for your help...
Dave