CSharp examples for System.Net:IP Address
host name to ip
using System.Text; using System.Net.NetworkInformation; using System.Net; using System;/* w w w.j ava 2 s .c o m*/ public class Main{ public static string hostname2ip(string host) { string ip = null; try { ip = Dns.GetHostEntry(host).AddressList[0].ToString(); } catch (System.Net.Sockets.SocketException sEx) { ip = sEx.Message; } catch (ArgumentException aEx) { ip = aEx.Message; } catch (Exception e) { ip = e.Message; } return ip; } }