说好的fsockopen的非阻塞模式呢?为什么还是会阻塞
function fsockopen_test(){<br /> $hostname = 'm.cn';<br /> $url = '/test/1.php';<br /> $fp = fsockopen($hostname, 80, $errno, $errstr, 5);<br /> if (!$fp) {<br /> echo "$errstr ($errno)";<br /> return false;<br /> }<br /> stream_set_blocking($fp,0);//开启了手册上说的非阻塞模式<br /> $header = "GET $url HTTP/1.1\r\n"; <br /> $header.="Host: $hostname\r\n";<br /> $header.="Connection: Close\r\n\r\n";//长连接关闭<br /> fwrite($fp, $header);<br /> fclose($fp);<br />}<br />fsockopen_test();
sleep(6);<br />$fp = fopen ( './data.txt' , 'w' );<br />fwrite ( $fp ,111);<br />fclose ( $fp );
echo date('Y-m-d H:i:s'), PHP_EOL;<br />fsockopen_test();<br />echo date('Y-m-d H:i:s'), PHP_EOL;<br />