Use the Static method Dns.GetHostAddresses to get a list of computer IP Addresses. First, you need to to get the Computer name. Then pass it as a parameter to the Dns.GetHostAddresses method.

Required Namespace:

System.Net

C#

String ComputerName= Dns.GetHostName();
IPAddresses[] localIPs = Dns.GetHostAddresses(ComputerName);
Last modified: March 8, 2019

Comments

Write a Reply or Comment

Your email address will not be published.