端口已处于监听状态,为什么 fsockopen还会失败,该怎么处理

WBOY
Release: 2016-06-13 10:21:47
Original
1075 people have browsed it

端口已处于监听状态,为什么 fsockopen还会失败
用netstat -a命令查看, 显示 TCP 0.0.0.0:2012 www:0 LISTENING
可是用PHP socket访问,代码如下:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$fp = fsockopen('202.117.xxx.xxx',2012,$errno, $errstr, 10);echo $fp ;
Copy after login

为什么还会提示unable to connect to 202.117.xxx.xxx:2012 (由于目标计算机积极拒绝,无法连接。 ) 呢?

------解决方案--------------------
那不是对方拒绝了吗?

ping 202.117.xxx.xxx:2012

telnet 202.117.xxx.xxx:2012

看看
------解决方案--------------------
localhost去连试试?
------解决方案--------------------
PHP code
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);   $connection = socket_connect($socket, '192.168.xxx.xxx', 2012);<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template