Thursday, 19 January 2012

C# Get server IP address

public static string GetIPAddress(string server)
{
    var host = Dns.GetHostEntry(server);
    if(host.AddressList.Length>0)
    {
        return host.AddressList[0].ToString();
    }
    return null;
}

No comments:

Post a Comment