Home > Article > Backend Development > 端口已处于监听状态,为什么 fsockopen还会失败,该怎么处理
端口已处于监听状态,为什么 fsockopen还会失败
用netstat -a命令查看, 显示 TCP 0.0.0.0:2012 www:0 LISTENING
可是用PHP socket访问,代码如下:
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$fp = fsockopen('202.117.xxx.xxx',2012,$errno, $errstr, 10);echo $fp ;
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $connection = socket_connect($socket, '192.168.xxx.xxx', 2012);<div class="clear"> </div>