1.判断一个IP是否可以连通2
2.判断一个IP的某个端口是否连通
1--------
Ping pingSender = new Ping();
string strIP =www.baidu.com //要ping的IP地址 第一种方法本人亲自试验过。可以使用
PingOptions pingOption = new PingOptions();
pingOption.DontFragment = true;
string data = "sendData:goodgoodgoodgoodgoodgood";
byte[] buffer = Encoding.ASCII.GetBytes(data);
int timeout = 120;
PingReply reply = pingSender.Send(strIP, timeout, buffer);
if (reply.Status == IPStatus.Success)
{
Response.Write("能ping通 ");
}
else
{
Response.Write("ping不通");
}
2 参考 apsxspy2
using System.Net.Sockets;
TcpClient iYap = new TcpClient();
try
{
iYap.Connect("127.0.0.1", 8008);
iYap.Close();
Response.Write("<font color=green><b>Open</b></font>");
}
catch
{
Response.Write("<font color=red><b>Close</b></font>");
}
你可以下个aspxspy2看看 aspx的木马