PING的C#版本
using System;
namespace Wuyin.Network.Components
{
/// <summary>
/// Ping 的摘要说明。
/// </summary>
public class Ping
{
public Ping()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static string[] GetHostIP(string host)
{
System.Net.IPAddress[] ips = System.Net.Dns.GetHostByName(host).AddressList;
string Ips = null;
foreach(System.Net.IPAddress ip in ips)
Ips+=ip+"|";
return Ips.Split(Convert.ToChar("|"));
}
}
}