Skip to main content

How To Get Mobile phone list connected with my wireless

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
kb_baloch
Offline
Joined: 2012-07-10

Hi
I have firstly search computers connected with my network(code is given given below) but(one problem with this is that it is very slow),this is showing me all computers(laptop[wireless]) connected with my network but now I want to show android, BlackBerry or other mobile phone devices connected with my network how can I do this can any one help me please.

public class NetworkPing extends JFrame{
public NetworkPing() {
}
public static void main(String[] args) throws UnknownHostException {
try {
second_testmethod();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void second_testmethod() throws IOException{
InetAddress localhost = null;
try {
localhost = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
// this code assumes IPv4 is used
byte[] ip = localhost.getAddress();
for (int i = 0; i < 255; i++)
{
ip[3] = (byte)i;
InetAddress address = InetAddress.getByAddress(ip);
if (address.isReachable(1000))
{
System.out.println("can b pinged");
// machine is turned on and can be pinged
}
else if (!address.getHostAddress().equals(address.getHostName()))
{
System.out.println("Name is......"+address.getHostName()+"\tIP is......."+address.getHostAddress());
// machine is known in a DNS lookup
}
else
{
System.out.println("nothing");
// the host address and host name are equal, meaning the host name could not be resolved
}
}
}
}//end of class

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
annaharris
Offline
Joined: 2012-04-08

Turning your cell phone into a wireless router requires the use of an ad hoc wireless network, which requires a single computer to be, designated the host.