Results 1 to 7 of 7
- 05-26-2009, 07:58 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 17
- Rep Power
- 0
- 05-26-2009, 08:10 AM #2
Hi,
InetAddress addr = InetAddress.getLocalHost();
System.out.println(addr.getHostAddress());
-Regards
RamyaRamya:cool:
- 05-26-2009, 08:20 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 17
- Rep Power
- 0
Thanks for your reply.
This code works fine, in normal java.
I created one applet program, which will give me the ipaddress.
Instead of giving, local machine's ipAddress, it is giving Localhost ip.
For eg, my ipAddress is 172.16.0.37.
But is giving me as, 127.0.0.1
- 05-26-2009, 09:41 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Please stick with a one thread. Do not post the same thread several times. Sorry I've to close the other thread.
- 05-26-2009, 09:49 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
This cannot be happen, except one thing. Did you read the Java doc?
Returns the local host.
If there is a security manager, its checkConnect method is called with the local host name and -1 as its arguments to see if the operation is allowed. If the operation is not allowed, an InetAddress representing the loopback address is returned.
- 05-26-2009, 09:54 AM #6
Member
- Join Date
- Apr 2009
- Posts
- 17
- Rep Power
- 0
Thanks for your reply,
How to get that clientIP?
i imported, the correct header file only,
import java.net.InetAddress;
i created one APPLET Program, in my local machine only.
If i execute, it is giving 127.0.0.1.
My IPAddress,172.16.0.37.
Code is working in normal java program. Not working in Applet Program.
- 05-27-2009, 04:27 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You say that when you run it as a console application, get the correct IP and not in the Applet?
I think you are using IE. IE cannot do this with the default security level. Go to the security tab and find the option "Allow access to all IP address" and enable.
Similar Threads
-
Applet with (label client side)?
By Godsent in forum Java AppletsReplies: 1Last Post: 04-30-2009, 10:46 AM -
ipaddress
By tej in forum NetworkingReplies: 7Last Post: 04-25-2009, 06:07 PM -
IPAddress to Country
By sandeeprao.techno in forum Advanced JavaReplies: 2Last Post: 12-19-2008, 01:39 AM -
Copy a .swf file from server side to client using signed applet
By Imoracle in forum Java AppletsReplies: 2Last Post: 10-05-2008, 06:13 PM -
How to track client logout time and orignal ipaddress (not gateway) in java
By psandeep in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 06-13-2008, 12:32 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks