PDA

View Full Version : ext gwt sample program to capture ip address



cahyadi
25 Dec 2011, 4:36 PM
I am new to gwt, I want to make my gwt program can capture localhost IP address, but I do not know how? I already use InetAddress, but the problem arises that does not support for gwt InetAddress .. one can show an example of a simple program to capture the localhost ip address? Here I am using netbeans 6.8, gwt gwt ext 2.4.0 and 2.2.5.
Please help me ...
thank you ..

Colin Alworth
29 Dec 2011, 8:02 PM
GWT (and so the Ext GWT library) compiles to javascript, and runs in the browser, so can only do what javascript in the browser can do. See http://stackoverflow.com/questions/391979/get-client-ip-using-just-javascript for a discussion on doing this in JS.

One option could be for the webserver to check for the client's address, and pass that back to the client (or use it on the server). Note that this may report multiple clients in certain situations to be the same IP address, such as when they are behind a NAT.

It is possible that you can use some other method to get the address locally - flash or somet other plugin perhaps.