rest_rpc
rest_rpc copied to clipboard
请问服务端有办法获取客户端调用的ip地址吗
有接口 https://github.com/qicosmos/rest_rpc/blob/master/include/rest_rpc/connection.h#L80
请问我使用rpc_conn 类调用 remote_address 没有成功,报错如下
/routing-service/server/RoutingService/RoutinServiceImplNew.cpp:17:27: error: 'using rpc_conn = class std::weak_ptr<rest_rpc::rpc_service::connection>' {aka 'class std::weak_ptr<rest_rpc::rpc_service::connection>'} has no member named 'remote_address'
17 | std::string id = conn.remote_address();
或者:conn->remote_address也没有成功
可这个应该是一个conn 的一个weak_ptr ,应该能调用connection 的方法
应该如何解决
发件人: @.*** @.> 代表 qicosmos 发送时间: 2022年9月10日 19:25 收件人: qicosmos/rest_rpc @.> 抄送: marchlion1 @.>; Author @.> 主题: Re: [qicosmos/rest_rpc] 请问服务端有办法获取客户端调用的ip地址吗 (Issue #80)
有接口 https://github.com/qicosmos/rest_rpc/blob/master/include/rest_rpc/connection.h#L80
— Reply to this email directly, view it on GitHub https://github.com/qicosmos/rest_rpc/issues/80#issuecomment-1242709262 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AL2IXZ6UICOWYX3UTUSX7UDV5RVY5ANCNFSM6AAAAAAQJEWSLM . You are receiving this because you authored the thread.Message ID: @.***>
https://github.com/qicosmos/rest_rpc/blob/master/examples/server/main.cpp#L78 先看看怎么正确拿到connection