I am working on wifi based chat engine and I was able to retrieve the list of hosts connected to current wifi network by followin this link and now got list of devices with ip addresses but i need host name from the ip address and tried following
InetAddress inetAddr;
try {
inetAddr = InetAddress.getByName(host.hostname);
String hostname = inetAddr.getHostName();
String canonicalHostname = inetAddr.getCanonicalHostName();
holder.computerName.setText("Canonical : "+host.hostname);
} catch (Exception e) {
e.printStackTrace();
}
Here the host name and canonical host name both are displaying ip address rather than host name.
Please help me how to achieve this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…