网上追捕(很多实用的port)

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

我们可以在Asp.Net中通过使用Sockets Class 来对InterNet 上的主机进行远程的控制和探测(不要搞破坏呀!)

下面给大家提供一个例子,可以对 指定的主机进行 探测:)功能类似 追捕。

<%@ 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 端口

/*

showmsg.Text=TcpConnect(tcpc,host,80); //WWW 端口

showmsg.Text=TcpConnect(tcpc,host,21); //FTP 端口

showmsg.Text=TcpConnect(tcpc,host,110); //Pop 端口

showmsg.Text=TcpConnect(tcpc,host,1080); //Socket5 端口 代理服务器使用的端口

showmsg.Text=TcpConnect(tcpc,host,53); //DNS 端口

*/

}

String TcpConnect(TCPClient tcpc,String host,int port){

StreamReader sr ;

String strRet="123";

if(0 == tcpc.Connect(host,port)){

//联结服务器成功

sr = new StreamReader(tcpc.GetStream(), Encoding.Default);

strRet=sr.ReadLine();

}

return strRet;

}

</script>

<html>

<head>

<title>网络追捕</title>

<link rel="stylesheet" type="text/css" href="/doufu.css">

</head>

<body>

<asp:Label id=showmsg runat=server />

</body>

</html>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航