Your question, your audience. Choose who sees your identity—and your question—with question security.
//For parsing the string to IP
IPAddress ip = IPAddress.Parse("127.0.0.1")
// To get the localhost IP
IPHostEntry iphost = Dns.GetHostByName(Dns.GetHostName());
IPAddress[] addr = iphost.AddressList;
for (int i = 0; i < addr.Length; i++)
{
listBox1.Items.Add(string.Format("IP Address {0}: {1} ", i, addr[i].ToString()));
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Open in new window