public static string[] getIpAddresses(string computerName)
{
string[] listeIp = null;
try
{
IPAddress[] adresseIp = Dns.GetHostEntry(computerName).AddressList;
if (adresseIp.Length > 0)
{
listeIp = new String[adresseIp.Length];
for (int i = 0; i < adresseIp.Length; i++)
{
listeIp[i] = adresseIp[i].ToString();
}
}
}
catch
{
// Dans le cas où l'hôte n'existe pas.
}
return listeIp;
}