LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Java Program to Display All IP Addresses in LAN (https://www.linuxquestions.org/questions/programming-9/java-program-to-display-all-ip-addresses-in-lan-864958/)

pelletibharath 02-25-2011 05:07 AM

Java Program to Display All IP Addresses in LAN
 
Hi Sir, I Want to Develop Network Scanner Software. For that i need "Java Program to Display All IP Addresses in LAN". Please, any one help me......

Aquarius_Girl 02-25-2011 05:25 AM

Before people start bashing you here ;) I would like to state that this is NOT the way
LQ goes, you need to SHOW your efforts, through code or through algorithms, what you have
read till now and where you are stuck etc.

Welcome to LQ.

pelletibharath 02-28-2011 12:57 AM

java program to display all ip addresses in lan
 
import java.util.*;
import java.lang.*;
import java.net.*;

public class GetOwnIP
{
public static void main(String args[]) {
try{
InetAddress ownIP=InetAddress.getLocalHost();
System.out.println("IP of my system is := "+ownIP.getHostAddress());
}catch (Exception e){
System.out.println("Exception caught ="+e.getMessage());
}
}
}

This code shows only my system IP address.But, i want to display all systems IP addresses connected in my LAN Network. Please help me with code....

Niartov 03-01-2011 11:49 AM

Do you know the Network Range you are on. If not you would need to get your subnet to calculate the ip range. After you know the range you are looking for you can check out the link for icmp pinging. This might not work if firewalls don't allow ICMP responses.



http://www.0x13.de/index.php/code-sn...g-in-java.html


All times are GMT -5. The time now is 03:12 AM.