
SwooleServer::connection_info 메서드는 Swoole 4.x 버전 이후로 제거되었습니다. 대신에 swoole_client::getInfo($fd) 메서드를 사용하여 fd에 대한 정보를 가져올 수 있습니다.
#hostingforum.kr
php
$serv->on('Receive', function ($serv, $servId, $fd, $data) {
echo "Client: $servId Receive msg: $datan";
$clientInfo = $serv->getClientInfo($fd);
var_dump($clientInfo);
});
위의 코드에서 $serv->getClientInfo($fd) 메서드를 사용하여 fd에 대한 정보를 가져올 수 있습니다.
또한, Swoole 4.x 버전 이후로 connection_info 메서드를 사용하여 fd에 대한 정보를 가져올 수 없으므로, 위의 오류 메시지를 출력하는 대신에, connection_info 메서드가 제거된 것을 알려주는 메시지를 출력할 수 있습니다.
#hostingforum.kr
php
$serv->on('Receive', function ($serv, $servId, $fd, $data) {
echo "Client: $servId Receive msg: $datan";
if (method_exists($serv, 'connection_info')) {
$clientInfo = $serv->connection_info($fd);
var_dump($clientInfo);
} else {
echo "connection_info 메서드는 Swoole 4.x 버전 이후로 제거되었습니다.n";
}
});
2025-04-06 03:07