How can i get the LAN IP-address of a computer using Java? I want the IP-address which is connected to the router and the rest of the network.
I\'ve tried something like
As Daniel already pointed out, you cannot know which interface is the one "connected". What if, for example, the computer has multiple network interface cards which are both connected to separate physical LANs?
Let the user decide which interface to use or try them all, depending on what your use case is.