Skip to Content
0
Former Member
Dec 14, 2011 at 03:06 PM

Get client IP address

52 Views

Hi ,

I need to get IP address of the client(user) not server. I tried with these codes, both these returned IP address of the server but not client. Is there any other way? Please help.

1) try{

InetAddress thisIp =InetAddress.getLocalHost();

String IPAddress = thisIp.getHostAddress();

wdContext.currentContextElement().setIp(IPAddress);

}catch(Exception ee){

}

2)

IWDRequest request = WDProtocolAdapter.getProtocolAdapter() .getRequestObject() ;

String ip= request.getClientHostAddress();

Thanks,

Jai