时间:2021-07-01 10:21:17 帮助过:30人阅读
连接需要20多秒
手册上没有吗?
设置$socket 发送超时1秒,接收超时3秒:
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,array("sec"=>1, "usec"=>0 ) );
socket_set_option($socket,SOL_SOCKET,SO_SNDTIMEO,array("sec"=>3, "usec"=>0 ) );
设置$socket 发送超时1秒,接收超时3秒:
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,array("sec"=>1, "usec"=>0 ) );
socket_set_option($socket,SOL_SOCKET,SO_SNDTIMEO,array("sec"=>3, "usec"=>0 ) );
socket_connect($socket, $address, $service_port) or die("could not connect with" . $address); 一般都是连接超时的,连接超时怎么办??