I got the program for Wifi tethering which i got a open (non secured) hot spot in Android. I like to view the details of client (SSID and IP address) connected to my hotspot.
I used SocketAddress socketid=socket.getLocalSocketAddress(); and also used
public void getLocalIpAddressString() {
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) {
// return inetAddress.getHostAddress().toString();
Toast.makeText(getApplicationContext(), inetAddress.getHostAddress().toString(),
Toast.LENGTH_SHORT).show();
}
}
}
} catch (Exception ex) {
Log.e("IPADDRESS", ex.toString());
}
// return null;
}
These will return only the local IP but can you please help me in getting the IP address of client connected to my Wifi Hotspot. Thank you.
Finally I got the response for getting the Client IP connected to my hotspot. The code below will track the Mac and IP changes each time a new client is added to my network