get host name and ip addresses
Published: 9. October 2011 | Updated: 9. October 2011License: Microsoft Public License (MS-PL)
Categories: Network
Tags: C# Network
Import namespace
using System.Net;
Code
var hostName = Dns.GetHostName(); var addresses = Dns.GetHostAddresses(hostName); foreach (IPAddress ipAddress in addresses) { Console.WriteLine(ipAddress); }
| Send us feedback about this snippet » |





