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

ASP
亲密接触ASP.Net(16)
NT 下虚拟域名的实现
介绍一种效率极高的分类算法
asp+发送email
用 ASP 技术开发 WEB 调查(投票)系统 (1)
用ASP技术开发 WEB 调查(投票)系统 (2)
用ASP技术开发WEB调查(投票)系统 (3)
ASP+全新接触
ASP+上载例子
从ASP迁移至ASP+--最初的考虑(一)
从ASP迁移至ASP+--进入DataSet
将HTML表格转换为ASP+数据列表(DataList)
急不可耐了?转换其他的页面吧!
用ASP解决域名登记查询
从ASP迁移至ASP+--处理会话变量
从ASP迁移至ASP+--CustomValidator控件
从ASP迁移至ASP+--从用户那儿收集数据
展现C#(1):C#简介
展现C#(2):NGWS Runtime 基础
展现C#(3):第一个C#应用程序

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 114 ::
收藏到网摘: 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>