Click here to Skip to main content
15,031,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want method which gives ip addresses of remote pcs those are in LAN?
Monalisa S 19-Nov-10 6:14am
i know this method i have tried it but its giving ip addresses of the pc on which i am running this method n not of the pcs connected in LAN
Manfred Rudolf Bihy 19-Nov-10 10:31am
What about my answer. Answer 2 should do the trick. Have you tried that? Instead of "" use the name of a pc on your LAN.
Monalisa S 20-Nov-10 3:02am
i want addresses dynamically of all pcs..
so this method will not help...

Hi Monalisa,

try this:

InetAddress inetAddress = InetAddress.getByName("");
byte[] raw = inetAddress.getAddress();

The byte array now contains the IP addresses bytes.


Ankur\m/ 18-Nov-10 8:05am
Edited for code formatting.
Manfred Rudolf Bihy 18-Nov-10 8:07am
@Ankur: Sorry! Skipped that step.
My third "have you searched Google" answer for the day. :doh:

See this: Google search - ip address java[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900