Results 1 to 6 of 6

Thread: List the IP addresses

  1. #1
    Join Date
    Dec 2009
    Posts
    263

    List the IP addresses

    Hello
    I would like to know if there is a way to list the IP addresses on a local network in Java. I was trying some of the programs, but I do not know is it possible in java or not? Even I an a new bee in java. So, any help will be highly appreciated. Thanks in advance.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: List the IP addresses

    Hi,
    You can do a broadcast ping (assuming it is approved by the administrator) and see what comes out (assuming that the machines are configured to respond to broadcast ping, assuming that packets are not lost ). Look at the doc ping; may need to pass the -b option. I think this should not be difficult for you.

  3. #3
    Join Date
    Dec 2009
    Posts
    263

    Re: List the IP addresses

    Hello,
    Thank you I'll try, apparently there is no solution in Java. I started a little in this area but how it works in general to find machines on a network if someone has a link that explains or can point me to a tutorial or a course that I assimilate the knowledge I need it would be cool. Still, I will try some more codes in java, so that I can get an over view of the concept of the networking in java.

  4. #4
    Join Date
    Dec 2009
    Posts
    211

    Re: List the IP addresses

    Hi,
    Even I have a similar kind of a problem. In fact I try to write a small Java program that allows me to transfer files between my PC (which are under different OSes) and I'd like the program to find the only PC on the network without my am obliged to enter the IP address myself. Even I am new to java, so please if you have any example which will explain me briefly, til will good for me. Thanks in advance.

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    Re: List the IP addresses

    Hello,
    For a list of computers connected to the LAN, it is simply impossible in general, it is necessary that the computers work together in a way or another:
    - either by registering somewhere (for example, if the network uses DHCP, perhaps the DHCP server can give you a list)
    - is being referenced by an administrator (look in / etc / hosts file, or files of definitions of DNS if it is a DNS server for LAN)
    - is responding to requests broadcast or multicast (all of a sudden he comes back that there is a multicast group all-hosts, "244.0.0.1, including LAN computers are auto part [1]).
    Hope this information will help you.

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: List the IP addresses

    Hello,
    Here is a small example code which will give you the client IP address.
    Code:
    import java.net.*;
    import java.io.*;
    import java.applet.*;
    
    public class getipextends Applet {
      public void init() {
        try {
         InetAddress ip =
            InetAddress.getLocalHost();
         System.out.println("IP:"+ip.getHostAddress());
         }
        catch(Exception e) {
         e.printStackTrace();
         }
        }
    }

Similar Threads

  1. How to NAT several public addresses
    By HarshaB in forum Networking & Security
    Replies: 5
    Last Post: 13-01-2010, 10:59 AM
  2. Extending IP addresses
    By Gunner 1 in forum Networking & Security
    Replies: 5
    Last Post: 26-12-2009, 11:39 AM
  3. Storing MAC addresses in AD
    By boris52 in forum Active Directory
    Replies: 4
    Last Post: 27-07-2009, 10:57 PM
  4. How to remove email addresses in entourage drop down list
    By Renderman21 in forum Windows Software
    Replies: 3
    Last Post: 25-06-2009, 11:49 AM
  5. Is there a way to query a DHCP server to get a list of MAC addresses?
    By mike_z@excite.com in forum Windows Server Help
    Replies: 7
    Last Post: 24-02-2006, 08:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,297,339.06784 seconds with 17 queries