Results 1 to 1 of 1
- 04-15-2009, 02:49 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 5
- Rep Power
- 0
not displaying all ip addresses connected to the network
import java.io.*;
import java.net.*;
import java.util.*;
import static java.lang.System.out;
public class ListNets
{
public static void main(String args[]) throws SocketException {
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets))
displayInterfaceInformation(netint);
}
static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
while(inetAddresses.hasMoreElements()==true)
{
System.out.println(inetAddresses.nextElement());
}
}
}
-------------------------------------------------------------------------
The output of this code gives only the ip of the computer im working on the network :192.168.1.101 and the local ip 127.0.0.1
although there are other computers connected to the netwrok .. i need to get all the ips connected including the ip of the router so if any 1 can please help me
Similar Threads
-
get list of all ip/host names connected on a network
By a_maged in forum NetworkingReplies: 0Last Post: 04-07-2009, 10:35 PM -
javax.mail.SendFailedException: Invalid Addresses;
By Anju Jose in forum Advanced JavaReplies: 2Last Post: 03-08-2009, 12:29 AM -
Using JSP, how can I call send sms from connected mobile
By java student in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 12-10-2008, 06:11 AM -
How to determine all the IP addresses of machines on local LAN??
By JavaEmpires in forum NetworkingReplies: 3Last Post: 01-19-2008, 06:05 AM -
how to read memory addresses
By fred in forum New To JavaReplies: 1Last Post: 07-24-2007, 01:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks