Reputation: 5430
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
Upvotes: 2
Views: 2583
Reputation: 83
ip = FlexContext.getHttpRequest().getRemoteAddr();
is gives whoz connected
Thanks Roman
Upvotes: 0
Reputation: 31
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();
}
Upvotes: 1
Reputation: 3119
I think you can get hold of it pretty easily. Not tested, but give it a try.
String ip = FlexContext.getHttpRequest().getRemoteAddr();
Upvotes: 1