连接socket分为连接超时和读取超时
$sock=stream_socket_client("www.google.com:80", $errno,$errstr,2); 那个数字是连接超时 ,...比如连接google , 2秒就返回错误 , 这样就不会一直等在那了
stream_set_timeout($sock,5); 这个数字是读取数据的超时
stream_get_meta_data 可以在...blocked"]=>
bool(true)
["eof"]=>
bool(true)
}
resource(175) of type (stream)
其中的timed_out就是读取数据的超时...,false为读取没超时
eof为是否已经到了文件尾,如果是长连接这里是不会到达文件尾的,http协议这种短连接会读完后连接就结束了