Live Chat Icon For mobile
Live Chat Icon

How can I get all IP addresses for my local machine

Platform: WinForms| Category: Deployment
[C#]
	string s ='';

	System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;

	for (int i = 0; i < addressList.Length; i ++)
	{
		s += addressList[i].ToString() + '\n';
	}

	textBox1.Text = s; 

[VB.NET]
	Dim s As String = ''

	Dim addressList As System.Net.IPAddress() = Dns.GetHostByName(Dns.GetHostName()).AddressList

	Dim i As Integer
	For i = 0 To addressList.Length - 1
   		s += addressList(i).ToString() + ControlChars.Lf
	Next i

	textBox1.Text = s

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.