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 think you can get hold of it pretty easily. Not tested, but give it a try.
String ip = FlexContext.getHttpRequest().getRemoteAddr();
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();
}
ip = FlexContext.getHttpRequest().getRemoteAddr();
is gives whoz connected
Thanks Roman
来源:https://stackoverflow.com/questions/1352751/can-i-get-the-clients-ip-address-in-an-lcds-service-call