灯火互联
管理员
管理员
  • 注册日期2011-07-27
  • 发帖数41778
  • QQ
  • 火币41290枚
  • 粉丝1086
  • 关注100
  • 终身成就奖
  • 最爱沙发
  • 忠实会员
  • 灌水天才奖
  • 贴图大师奖
  • 原创先锋奖
  • 特殊贡献奖
  • 宣传大使奖
  • 优秀斑竹奖
  • 社区明星
阅读:3929回复:0

vb编写端口扫描器

楼主#
更多 发布于:2012-09-08 11:51

Private Sub Command1_Click()
Dim x As Integer
Dim items As ListItem
Dim PortsChecked As Integer
PortsChecked = Int(Text1.Text)
'逐个端口检测
For x = 1 To PortsChecked
Label2.Caption = "扫描中。。。"
DoEvents
Winsock1.LocalPort = x
On Error Resume Next
Winsock1.Listen
'如果得到错误代码,说明此端口被使用
If Err.Number = 10048 Then
Set items = ListView1.ListItems.Add(, , Winsock1.LocalIP)
items.SubItems(1) = x
Err.Number = 0
End If
Winsock1.Close
Label2.Caption = "扫描完毕。。。"
Next x
End Sub




喜欢0 评分0
游客

返回顶部