根据域名解析IP地址的c#类

2009年3月22日星期日

根据域名解析IP地址的c#类

这是一个用C#写的根据域名解析IP地址的类,可以直接调用.

class ResolveDNS
{
IPAddress[] m_arrayIPs;
public void Resolve(string s_host)
{
IPHostEntry ip = Dns.GetHostByName(s_host);
m_arrayIPs = ip.AddressList;
}
public IPAddress this[int nIndex]
{
get
{ return m_arrayIPs[nIndex]; }
}
public int IPLength
{
get
{
return m_arrayIPs.Length;
}
}
}

0 评论:

发表评论