AsyncTcpConnection 动态创建链接的问题

0

if(!$_SESSION['Async_TcpCon']){//以客户端方式连接
$_SESSION['Async_TcpCon'] = 'tcp'.$uid;
$_SESSION['Async_TcpCon']= new AsyncTcpConnection('Jt808://127.0.0.1:20000');
$_SESSION['Async_TcpCon']->onMessage = function( $_SESSION['Async_TcpCon'], $Async_buffer){//客户端收到消息
var_export('...Async_buffer........'. $Async_buffer ."...............\n");
};
$_SESSION['Async_TcpCon']->onClose = function( $_SESSION['Async_TcpCon']){
echo "connection closed\n";
$_SESSION['Async_TcpCon']->reConnect(1); // 如果连接断开,则在1秒后重连
};
$_SESSION['Async_TcpCon']->connect();//// 执行异步连接
}
$_SESSION['Async_TcpCon']->send($message);
这样动态创建的链接 不能用

已邀请:

walkor

赞同来自:

session不能存储连接资源

要回复问题请先登录注册