PHP 当我调用 socket_create 时,它会阻塞并且没有任何反应。
这是代码。我从 php.net 复制它我使用 WebMatrix , IIS Windows。(不是阿帕奇)
$address = '192.168.0.234';
$port = 1000;
echo "address is : $address --- <br/><br/><br/>" ;
echo "before socket_create ... <br/> " ;
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) ;
echo "after socket_create <br/> " ;
echo "before socket_bind() <br/> " ;
if (socket_bind($sock, $address, $port) === false) {
echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
}
if (socket_listen($sock, 5) === false) {
echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n";
}
?>
当我运行它时,它只显示:在socket_create之前......然后什么也没发生帮助!