1
I am trying to connect to a local network server using the hostname (can not use IP because the client network does not allow to put fixed ip and the equipment does not have IP reservation for MAC).
So, I’m trying to do this from an Android application, until the moment I was able to search the IP from the hostname but as there is more than one network card on the machine, is only returning me one of the Ips.
The code that is returning me an IP is as follows: (in asyncTask)
ArrayList <String> lista = new ArrayList<String>();
try
{
InetAddress ipaddress = InetAddress.getByName(hostname);
lista.add(ipaddress.getHostAddress());
}
catch (UnknownHostException e)
{
lista.add("Ip não encontrado para o hostname: "+ hostname);
}
return lista;