按手冊上說
我寫了個代碼了一下:
<?php
$data="
//
$host =
$url = "/aa
$pffirst = false;
$times =
$startTime = microtime(true);
for ($index =
echo httpPost($host
}
$middleTime = microtime(true);
for ($index =
echo httpPost($host
}
$endTime = microtime(true);
echo ($pffirst?"pfsocket":"fsocket")
echo "<br />";
echo ($pffirst?"fsocket":"pfsocket")
$count=
//發包函數
function httpPost($host
{
global $count;
$func = $p?"pfsockopen":"fsockopen";
$conn = $func($host
if (!$conn)
{
echo "$errstr ($errno)<br />n";
return;
}
$header = "POST "
$header
$header
$header
$header
$header
fwrite($conn
$count++;
echo $count
$resp=
//while (!feof($conn)) {
// $resp
//}
//fclose($conn);
return $resp;
}
?>
結果發現:
代碼的倒數第二行
fsocket:
pfsocket:
如果不注釋:
fsocket:
pfsocket:
可以看出
而pfsocketopen在Keep
一次連接發送大量數據時
From:http://tw.wingwit.com/Article/program/PHP/201311/20862.html