First... I've search'd for this on google and didn't find any good answer.
Then I've searched for it on this forum... but, i only found only a thread-question about it with only one answer
"Please do not cross-post the same question in multiple forums" etc. and topic is closed.
So, I cannot find it by using search feature on this forum, and the guy in that topic suggests that this question was made earlier.
If teh answer for my question exists on this forum, then it needs better tags to find it - I just couldn't. Typing anything related to this I got no results, or got too many not related to my question.
That is the reason why i am re-posting this question - I couldn't find and it is hard (if it is even possible) to find an anserwer to my question by using search..
How I can get/list all IP addresses of machines I am connection to via LAN - Can I even do that with Java? or if not, how can I do it with native C++ on linux,mac and windows (i am not a c++ programmer, so i would need a complete examples)
I'd rather prefer a non-native solution.
Why the hell users are displayed as their first and last name...
jarek notgonnashare wrote:I can get/list all IP addresses of machines I am connection to via LAN
I am afraid that I don't understood well your question.
A. Do you want to know the IP addresses of the machines from the same LAN?
B. Do you want to know all the IP addresses of a system to which you have a remote connection?
For both, there's no standard API in JDK.
The only thing you have in JDK is NetworkInterface.getNetworkInterfaces() which give you an array of network interfaces (cards). Every one can list its own IP addresses.
The other Java native ways I don't know.
Not necessarily. You can use InetAddress.getLocalHost(), and NetworkInterface.getNetworkInterfaces() (as Aurelian Tutuianu suggested). With those you can get the IP address(es) of your machine. Using the former:
I was thinking on the same solution as Rob Prime stated before. But there is a problem with that solution - pinging all the possible hosts based on IP.
I wonder that is possible the have in the same LAN different IP classes, I think yes but I am not sure. If it's true than the ping solution must be extended somehow.