Tofu is made of excellent products
Http://www.asp888.net bean curd technology station
In Asp. Net, we can use Sockets Class to remotely control and detect hosts on the InterNet (do not destroy them !)
In the following example, tofu provides an example to detect a specified host. The function is similar to hunting.
<% @ Import Namespace = "System. Net" %>
<% @ Import Namespace = "System. Net. Sockets" %>
<% @ Import Namespace = "System. IO" %>
<Script language = "C #" runat = server>
Protected void Page_Load (Object Src, EventArgs E ){
TCPClient tcpc = new TCPClient ();
String host = "host ";
Showmsg. Text = TcpConnect (tcpc, host, 25); // SMTP Port
/*
Showmsg. Text = TcpConnect (tcpc, host, 80); // WWW Port
Showmsg. Text = TcpConnect (tcpc, host, 21); // FTP port
Showmsg. Text = TcpConnect (tcpc, host, 110); // Pop Port
Showmsg. Text = TcpConnect (tcpc, host, 1080); // port used by the proxy server of Socket5
Showmsg. Text = TcpConnect (tcpc, host, 53); // DNS port
*/
}
String TcpConnect (TCPClient tcpc, String host, int port ){
StreamReader sr;
String strRet = "123 ";
If (0 = tcpc. Connect (host, port )){
// The connection to the server is successful.
Sr = new StreamReader (tcpc. GetStream (), Encoding. Default );
StrRet = sr. ReadLine ();
}
Return strRet;
}
</Script>
<Html>
<Head>
<Title> Web tracking </title>
<Link rel = "stylesheet" type = "text/css" href = "/doufu.css">
</Head>
<Body>
<Asp: Label id = showmsg runat = server/>
</Body>
</Html>