AsyncTcpConnection斷線重連只能觸發(fā)一次,我是寫在onClose里面,代碼:
$connection_to_ser->onClose = function($connection_to_ser){
echo "connection closed\n";
Timer::add(5,function($connection_to_ser,$b){
echo $b;
$connection_to_ser->connect();
},array($connection_to_ser,"ttttt"),false);
};
發(fā)現(xiàn)不論連到哪個(gè)IP的任意端口都能連上,控制臺都是輸出start success,導(dǎo)致第二次onClose不執(zhí)行了,什么原因?