In C#, how do I resolve the IP address of a host?

Dee picture Dee · Jun 23, 2009 · Viewed 9.6k times · Source

How can you dynamically get the IP address of the server (PC which you want to connect to)?

Answer

Michael picture Michael · Jun 23, 2009

System.Dns.GetHostEntry can be used to resolve a name to an IP address.