当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 网上追捕(很多实用的port)

ASP.NET
Java、C#泛型的一些个人看法
用JScript.net写.net应用程序
.Net Remoting实现定向广播
ASP.NET 与 Ajax 的实现方式
在.NET环境下绘制模糊数学中隶属函数分布图
.Net UCS2 加码最简单的方法
在VS2005中创建并使用MasterPage
无废话C#设计模式之十三:Decorator
用 C# 编程实现读写Binary
无废话C#设计模式之十二:Bridge
无废话C#设计模式之十一:Composite
ASP.NET连接Access和SQL Server数据库
.NET和J2EE该相互学习什么
ASP.NET 2.0功能扩展:跨页提交
巧用escape解决ASP.NET中URL传参乱码问题
理解ASP.NET中的三层结构
解读ADO.NET2.0的十大最新特性
ASP.NET教程:抽象工厂模式
ASP.NET教程:抽象类和接口的比较
C#实现USB接口的程序代码

ASP.NET 中的 网上追捕(很多实用的port)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 57 ::
收藏到网摘: n/a

豆腐制作 都是精品
http://www.asp888.net 豆腐技术站

我们可以在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>