扫描计算机的端口号
2014-10-21 23:07
99 查看
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace 扫描计算机的端口号 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); if (string.IsNullOrEmpty(textBox1.Text.Trim())||string.IsNullOrEmpty(textBox2.Text.Trim())||string.IsNullOrEmpty(textBox3.Text.Trim())) { MessageBox.Show("输入端口号和IP地址。。。","提示"); return; } IPAddress ip = IPAddress.Parse(textBox3.Text.Trim());//通过IP字符串实例化IPAddress类 for (int i =Convert.ToInt32(textBox1.Text); i < Convert.ToInt32(textBox2.Text)+1; i++) { TcpClient tx = new TcpClient();//实例化 try { tx.Connect(ip, i);//使用IP地址和端口号连接主机。 listBox1.Items.Add("COM:" + i + "是开放的."); } catch { } finally {tx.Close();//释放该实例,但不关闭基础连接。} } listBox1.Items.Add("扫描结束!"); } } }
相关文章推荐
- 查看计算机的端口号是否被占用
- 计算机安全漏洞是扫描那里?
- java 是扫描计算机的全部文件
- 第三次CCF计算机软件能力认证考试题解(Java)--201412--Z字形扫描--100分通过
- 【计算机网络学习笔记】端口号
- 计算机图形学-基于OpenGL的直线扫描程序
- 计算机常用端口号
- 端口号扫描工具---nmap
- 【计算机网络】端口号的分类
- 计算机网络 之 TCP和UDP的端口号解析
- 【计算机网络学习笔记】端口号
- .NET扫描远程计算机注册表
- c#初学日记:多线程扫描网络计算机1
- 计算机网络简单分类普及扫描
- 计算机图形学 学习笔记(二):多边形扫描转换:X扫描线算法 和 改进的X扫描线算法
- 443端口 (HTTPS) && 计算机常用端口号一览功用详细说明
- C#扫描计算机端口
- 如何防止黑客扫描你的计算机?
- 计算机图形学 学习笔记(六):消隐算法:Z-buffer,区间扫描线,Warnock,光栅图形学小结
- 计算机图形学基础 : 基本图形生成算法之直线的扫描转换