$per_len = 20000; //每次读多少字节
$no_read_len = $content_len; //未读的字节(总字节大小)
$str = ‘‘;
while($len<$content_len)
{
$read = socket_read($socket, $per_len,PHP_BINARY_READ);
$str .= $read;
$len += strlen($read); //总共读了多少字节
}
http://hi.baidu.com/cuttinger/item/1c4444266f2b463395f62bfa
php socket接受大数据死循环,接收不全的问题,布布扣,bubuko.com
原文地址:http://seetobest.blog.51cto.com/1351397/1408556