localIP =“?”;
try
{ host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily.ToString() == "InterNetwork")
{
localIP = ip.ToString();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.toString());
}