• Post Reply Bookmark Topic Watch Topic
  • New Topic

Find the wired and wireless connections in a network  RSS feed

 
palavesamuthu Ram
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to list the all the connected devices in the network(wired and wireless)

InetAddress i = InetAddress.getLocalHost();
byte[] ip1 = i.getAddress();
for (int b = 0; b <12;b++)
{
ip1[3] = (byte)b;
InetAddress address = InetAddress.getByAddress(ip1);
if (address.isReachable(3000))
{
System.out.println("Name :"+address.getHostName()+"\tIP :"+address.getHostAddress());
}
else if (!address.getHostAddress().equals(address.getHostName()))
{
System.out.println("Name :"+address.getHostName()+"\tIP :"+address.getHostAddress());
}
else
{}
}

It prints all the connected devices but how to identify which are wired connection and which are wireless?
 
Janeice DelVecchio
Bartender
Posts: 1812
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

If you can get the MAC address of the device, you could do a lookup on the it via public web service or file to see the type of network card it is... then you could get the information that way. If it's a known network (like your own), you could keep a list of MACs in a file and record whether they're wireless or wired.

I dunno if it's the best way, but it's "a" way.
 
palavesamuthu Ram
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Janeice. I need to collect more details about the device(ex. computer or router and its details).

After seeing many examples, now I list all the machine(cpu details, os version) details which are connected in my network using snmp4j.
From this,Is there any way to find the machine is connected in wired mode or wireless mode, using snmp4j??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!