I have PHP socket server working on one server. I have replicate the code and put it on another server(Windows server 2012 r2). I have changed few things e.g. localhost ip and port. when I run the file through cmd it doesn't do any thing.
here is the code.
$address=gethostbyname('localhost');
$port = 99999;
echo $address;
echo 'Hello';
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
}
echo 'Hello2';
if (socket_bind($sock, $address, $port) === false) {
echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
}
echo 'Hello3';
if (socket_listen($sock, 5) === false) {
echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
}
Here is the out put I get. I have not disabled any error reporting either.
As you can see its just 'echoing' first hello and then just shows the new line.
So any idea why it is doing it?
p.s. php_sockets.dll is enabled. I have tried changing ip to ipv6 and some other ports but on luck.
Many Thanks in advace.