Home Answers Viewqa Java-Beginners java get all ip addresses in a lan

 
 


kallanpv
java get all ip addresses in a lan
5 Answer(s)      2 years and 7 months ago
Posted in : Java Beginners

Anybody have any idea on using java or cpp on how to get the ip addresses of all the machines[win or linux] connected to a computer in a LAN?. If this is not possible is there any function to know that a given ip address computer is connected in a LAN?. I could supply ip's and know the machine exists or not.

View Answers

April 12, 2011 at 8:32 PM


InetAddress localhost = InetAddress.getLocalHost();

// this code assumes IPv4 is used

byte[] ip = localhost.getAddress();

for (int i = 1; i <= 254; i++) {

ip[3] = (byte)i;
InetAddress address = InetAddress.getByAddress(ip);
if (address.isReachable(1000))
{
    // machine is turned on and can be pinged
}
else if (!address.getHostAddress().equals(address.getHostName())
{
    // machine is known in a DNS lookup
}
else
{
    // the host address and host name are equal, meaning the host name could not be resolved
}

}


May 20, 2011 at 4:31 PM


It takes too much time to find Ip addresses connected to LAN I have 100 PCS in Lan it takes 9 minutes so its is time consuming and i want display it in the Jcombobox so please give me the fastest way thanks and regards Nilesh Gawade


October 28, 2011 at 2:26 AM


may be u can make it using Thread each Thread control over a limited range such as 10 0-9 and make array of Thread ........ use it.


October 28, 2011 at 3:04 AM


import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.imageio.*;
import javax.swing.*;
import java.io.*;
import java.awt.image.*;
import java.net.*;




public class NetScanner implements Runnable
{
    String str;
    int nub;

    public NetScanner(String str,int nub)
    {
        this.str = str; 
        this.nub = nub;
    }
/*  
    public void checkHost()
    {
        for(int i=0; i<256;i++)
        {
            if(IntelAddress.getByName(str+"."+i).isReachable(1000))
                System.out.println("host"+str+"."+i+"is connected");
        }

    }
*/
    public void run ()
    {
        try
        {
        for(int i=nub; i<nub+10;i++)
        {

        System.out.println(".......");
        System.out.println(str);
        System.out.println(nub);
            if(InetAddress.getByName(str+"."+i).isReachable(1000))
                System.out.println("host"+str+"."+i+"is connected");
        }
        }
        catch(Exception e){System.out.println(e);}
    }
    public static void main(String []args)
    {
        //System.out.println("give subnet");
        //Scanner out = new Scanner(System.in);
        //NetScanner n = new NetScanner(out.next());
        Thread t[] = new Thread[25];
        for(int i=0; i<25;i++)
        {
            t[i] = new Thread(new NetScanner("10.124.168",i*10));
        }
        for(int i=0; i<25;i++)
        {
            t[i].start();
        }

    }

}

October 28, 2011 at 3:05 AM


u may check it i m not conformed but it may work









Related Pages:
java get all ip addresses in a lan
java get all ip addresses in a lan  Anybody have any idea on using java or cpp on how to get the ip addresses of all the machines[win or linux... to know that a given ip address computer is connected in a LAN?. I could supply
how to get an lan system ip and mac address in java code
how to get an lan system ip and mac address in java code  strong text
Getting IP address of All the machines
Getting IP address of All the machines  Program how to fetch All the IP address on my domain(LAN) in java
VoIP LAN
wireless VoIP unit . All you need to do is connect the ethernet cable to your LAN...;   VoIP LAN Phone IN-Call LAN Phone is a full-featured IP... communication. Over the office LAN, it provides IP-PBX solution such as station
block IP of LAN machines from server - RMI
block IP of LAN machines from server  i want to block the IP of machines from server ,that are connected in LAN.. all machines access net through... is it possible to block IP of LAN machines from server
Get IP Example
() : Network Interface class is used for get name, and a list of IP addresses... Get IP Example       This example shows you ip address of your network
Get IP Address Example
Get IP Address Example   ... : NetworkInterface.getNetworkInterfaces() : Network Interface class is used for get name, and a list of IP... for get the list of all InterfaceAddresses of this network interface
Get System Ip
Get System Ip      ... to get a IP address. For this we have a class name GetSystemIP,Inside the main... Interface made up of a name and a list of IP addresses assigned to this interface
Java Get IP Address
Java Get IP Address       This section illustrates you how to obtain the IP Address of local host... getHostAddress() returns the IP address.     Here is the code of Java Get IP
Get GMT from IP
Get GMT from IP  How do I get GMT value from IP address?? Thanx in Adv
LAN - JSP-Servlet
LAN  hi i want java code for LAN messenger.plse sens me
Network monitoring under LAN
Network monitoring under LAN  am in search of a java program that monitors the real time traffic statistics such as datarate,traffic flow of a LAN....can any one help me by posting java codes or related ideas
Java Get Example
practice   IP Address:  This Java Get IP Address example... in the network for communication. To get IP address of our own system in a java.... Java get available Font In order to retrieve all the available fonts, we have used
Find Exact Location from IP address in java?
Find Exact Location from IP address in java?  I am looking for API where we can pass IP address and get the location (Cityname,Country name). please suggest any API OR sample code. Thank you
Java Get Example
practice   IP Address:  This Java Get IP Address... in the network for communication. To get IP address of our own system in a java... Java Get Example      
PHP Get Browser IP Address
PHP Get Browser IP Address PHP provides us  $_SERVER['REMOTE_ADDR'] function is used to display the Browser IP address PHP Get IP Address Code: <?php echo "My Browser IP is :". $_SERVER['REMOTE_ADDR']; ?>
To retrieve the IP address from Host Name, vice-versac
the name and IP addresses. Enter "exit". roseindia Cannot find host... To retrieve the IP address from Host Name, vice-versa... to explain the method to find out the IP address from host name and to vice verse. Here
code for LAN Messenger - JSP-Servlet
code for LAN Messenger  User has to add the Valid System Name (the Name of the System on the LAN). After Adding System Name, he just have to Select... not have to Add the System Name again and again once user Close the Application all
Java example program to get IP address of own system
Java example program to get IP address of own system       java get own IP address An IP... is assigned to the devices participating in the network for communication. To get IP
PHP GD Get System IP
<?php $image = imagecreatetruecolor(150,70); $ip = "$_SERVER[REMOTE_ADDR]"; imagestring($image, 10, 20, 36, $ip, 0x00ff00); header... running the program you will get the following output
Overview of Networking through JAVA,To retrieve the IP address from Host Name, vice-versa
\complete>java HostLookup Enter the name and IP addresses. Enter... and IP addresses. ");       System.out.println("Enter \"exit\".");       try... To retrieve the IP address from Host Name, vice-versa
call another computer in LAN (no internet acces)
call another computer in LAN (no internet acces)  Any idea how to develop a java application that makes VOIP calls inside an isolated (without internet access) network? Is there any (free) software solution for my problem? Thank
Getting IP Address
Getting IP Address  Hi... i want to get the ip address of the current machine running my jsp program.... example: my ip is 172.16.11.247... from... get the ip address 247 in database but i need to get the ip address
Getting IP Address
Getting IP Address  Hi... i want to get the ip address of the current machine running my jsp program.... example: my ip is 172.16.11.247... from... get the ip address 247 in database but i need to get the ip address
Get All Keys and Values of the Properties files in Java
Get All Keys and Values of the Properties files in Java... how to get all keys and it's values of the properties files in Java. Java... to be inserting in the properties files. Here, you will get the all keys and values
Get All Keys and Values of the Properties files in Java
Get All Keys and Values of the Properties files in Java... to get all keys and values of the properties files in the Java. This section...: Here, you will get all keys and values of the properties files with the help
problem in sending data from one ip to another ip in JAVA
device in JAVA. i know how to ping but don't how to send the msg's to another IP...problem in sending data from one ip to another ip in JAVA  Hi guys . this is naveen kumar...i need a help. i want to connect one ip to another ip
Example program to get all the available time zones
to get all the available time zones using java program. This example is very simple java code that will list all the available time zones. We have used... Example program to get all the available time zones
Get all file size on FTP Server
In this section we are going to describe how to get size of FTP server files using java
VoIP Over WiFi
wireless LAN protocols, like the Internetworking Protocol (IP) that the Internet... is reminiscent of the early days of DOS, Windows and TCP/IP, with third-party stacks'n'apps, work needed to get each system going, random hacks like Slirp
Get Local Host Name
returns you Enumeration with  all the  subset of the Inet addresses... Get Local Host Name     ... you in understanding a code how to 'Get Local Host Name'. For this we have
Java Networking - JSP-Servlet
Java Networking  I want to get all systems' (computer,printer,laptop) IP address on LAN using java code. I tried a lot but find only my system's IP. I want java code for dat
ALL command - SQL
ALL Command in Java & SQL  Nee all commands in Java.  Dear Manoj, I didn't get u what do u mean by all command. could u please... THAT ARE USED IN JAVA ARE GIVEN BELOW 1.javac c:\ javac classname.java
Java Get Host Name
Java Get Host Name       In this Example you will learn how to get host name in Java. Go through... of a computer or an IP address using Java application language. The given program
Why do I need Dedicated IP?
who want to buy the unique IP addresses for a premium price. Another...A dedicated IP means that a website has its own IP address. When users type URL or the IP address it brings to the same domain name. Dedicated IP address
java inetaddress
java inetaddress       This class of java in "java.net" represents an Internet Protocol (IP... useful methods for obtaining host names and IP addresses, to check
Java get System Locale
Java get System Locale       In this section, you will learn how to obtain the locale. We... by using the System.getProperty(). This will provide all the properties of the system
php list all server variables
PHP list All server variables is present in the $_SERVER environment variables. Using the for each loop all keys and values can be accessed Example of PHP List all Server <?php     print"<table
IP Filter Example
IP Filter Example      ... for a firewall to determining what traffic passes through the firewall based on IP address... the risk from out side attacks is to filter incoming requests based on the IP address
How to get enum value in Java
How to get enum value in Java  Hi all, i am looking for a solution to get an enum value from index in Java. Please suggest. Thanks
Network IP Setting in Windows 8
is the 'Network IP Setting' of your PC. So, let us learn how to configure your Network IP in Windows 8 on your PC. 1. To access your Network IP setting, first of all go to the start menu on your Desktop and Select the 'Network' option
Getting Information of All Available Time Zones
program shows you how to get about all the information for the time zones... Getting Information of All Available Time Zones.... Most application software uses the underlying operating system for getting all
Problem in setting IP address for a JFrame Class Desktop Application
Problem in setting IP address for a JFrame Class Desktop Application  ..., the browser is unable to load anything. I don't know how to set IP address for our... addresses. Kindly help me.....Thanks in advance
How to get client's address in a servlet
How to get client's address in a servlet       This is detailed java code to get...() of the ServletRequest interface which returns IP address of the client
Java get windows Username
Java get windows Username     ... by using the System.getProperty(). This will provide all the properties... of the particular system from all the properties of Windows.    
Getting all XML Elements
Getting all XML Elements        In this section, you will learn to retrieve all... and methods which helps us to parse the XML file and retrieve all elements
finding the ip address of other system and store in the database - JDBC
finding the ip address of other system and store in the database  code to find the ip address,host name and their locale of other system that are connect to our system and store all these field or some of the fields
Get XML Elements
Get XML Elements       In this section you will learn to develop a simple java program to get the names of all elements contained in the XML document . Description of the program
Website deployment on LAN
Website deployment on LAN  I have created a dynamic website in netbeans. Now i have to host the website on LAN so that by typing the URL of the project the users are able to view the content from their end. I have no idea
Java get available Font
Java get available Font       In this section, you will learn how to get the available font. In order to retrieve all the available fonts, we have used the AWT package

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.