473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

IP Address Issue

I got one problem i have two ipaddresses in my system i want to see only my local ethernet ip only. is there any method. getlocalhost() will pick random ipaddress. I want to get my exact ipaddress. Please help me....?


Regards,
Praveen Kumar Divvela
Wipro Technologies, Bangalore.
my mail id:<Removed>
Sep 17 '07 #1
2 1257
Nepomuk
3,112 Expert 2GB
I got one problem i have two ipaddresses in my system i want to see only my local ethernet ip only. is there any method. getlocalhost() will pick random ipaddress. I want to get my exact ipaddress. Please help me....?


Regards,
Praveen Kumar Divvela
Wipro Technologies, Bangalore.
my mail id:<Removed>
Hi Praveen Kumar Divvela! Welcome to TSDN!

Please, when you have a question, open your own thread instead of using someone elses.

About your question:
Expand|Select|Wrap|Line Numbers
  1. InetAddress.getLocalHost().getHostAddress()
  2.  
might be the solution. If however it doesn't work (i.e. choses randomly), try
Expand|Select|Wrap|Line Numbers
  1. InetAddress[] inet = InetAddress.getAllByName(InetAddress.getLocalHost().getHostAddress());
  2. for (int x = 0; x < inet.length; x++)
  3. {
  4.     System.out.println("IP " + (x + 1) + ": " + inet[x].toString().substring(1));
  5. }
  6.  
to get all IPs. Then filter them manually (i.e. "which one starts with 127").

Greetings,
Nepomuk
Sep 17 '07 #2
Ganon11
3,652 Expert 2GB
I've split your question into a new thread. As nepomuk says, please use your own thread for asking questions, never another person's.
Sep 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Juha Suni | last post by:
I was faced with a difficult configuration issue a few days ago with another companys web service. In short, their web service requires the user to login on their page before their service can be...
7
by: Jay | last post by:
Hi, I am using the MailMessage object to send mails. One issue that I am currently facing is that the 'From' address that I provide is not getting resolved. I was testing the code with the same...
35
by: hasho | last post by:
Why is "call by address" faster than "call by value"?
29
by: chellappa | last post by:
hi all I need to write a program to find mac address of a my computer using libaries, is this possible? How? thanks
5
by: Kamaluokeakua | last post by:
I have to write an application that deals with clients in multiple countries. The addresses, phone numbers, country id and currency information has to be stored into a database that allows for the...
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
12
by: greg_chu | last post by:
Hi, I know I can use ipconfig.exe is DOS to get my IP address, the situation is I need to automat this process. I need to write a DOS program which issue a command to run IPCONFIG to get the IP...
8
by: msnews.microsoft.com | last post by:
Our IT team relocated our application servers yesterday. They had to take one machine out of the cluster because it would prompt users for credentials if accessed using the IP address, which I...
7
by: John Koleszar | last post by:
Hi all, I'm porting some code that provides compile-time assertions from one compiler to another and ran across what I believe to be compliant code that won't compile using the new compiler. Not...
10
by: themadjester | last post by:
This is weird, I know what an IP address conflict is, and how to avoid it, but this problem seems atypical - and apparently client side? Basically I have a router internet network, it is DHCP and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.