<?php
set_time_limit(0); 
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_nonblock($sock);
socket_connect($sock, '183.247.166.299', 10000);  
socket_set_block($sock);
switch(socket_select($r = array($sock), $w = array($sock), $f = array($sock), 5))
{
       case 2:
               echo "[-] Connection Refused\n";
               break;
       case 1:
               echo "[+] Connected\n";
               break;
       case 0:
               echo "[-] Timeout\n";
               break;
}
?>代码如图,要求是用服务器作为客户端像单片机发送一个tcp请求,但是测试连接不成功,该怎么办。报错如下
Warning: socket_connect() [function.socket-connect]: unable to connect [0]: 无法立即完成一个非阻止性套接字操作。 in C:\phpstudy\WWW\abc.php on line 5Strict Standards: Only variables should be passed by reference in C:\phpstudy\WWW\abc.php on line 7Strict Standards: Only variables should be passed by reference in C:\phpstudy\WWW\abc.php on line 7Strict Standards: Only variables should be passed by reference in C:\phpstudy\WWW\abc.php on line 7
[-] Timeout
服务器上安装了tcp测试连接的软件,是可以连接上去的。我怎么会这样呢?