本文介绍了我可以在 LCDS 服务调用中获取客户端的 IP 地址吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当客户端发出特定的 LCDS 服务调用时,我试图找到他们的 IP 地址.了解获取真实"IP 地址的所有问题和隐私问题等,是否有可能找到客户端的 IP 地址?
I'm trying to find the IP address of a client when they make a particular LCDS service call. Understanding all the issues of getting a "real" IP address and privacy concerns and so on, it is possible to find the client's IP address?
tj
推荐答案
我没有找到如何通过简单的方法调用对所有通道类型执行此操作的方法.所以我使用这样的代码:
I didn't find a way how to do it for all channel types with a simple method call.So I use such code:
String ip;
Endpoint clientEndpoint = FlexContext.getEndpoint();
if (clientEndpoint instanceof RTMPEndpoint) {
ip = ((RTMPFlexSession)FlexContext.getFlexSession()).getClientInfo().getIp();
}
if ((clientEndpoint instanceof NIOAMFEndpoint) || (clientEndpoint instanceof AMFEndpoint)) {
ip = FlexContext.getHttpRequest().getRemoteAddr();
}
这篇关于我可以在 LCDS 服务调用中获取客户端的 IP 地址吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!