vb编写端口扫描器

页面导航:首页 > 软件编程 > vb.net > vb编写端口扫描器

vb编写端口扫描器

来源: 作者: 时间:2016-01-21 10:23 【

Private Sub Command1_Click()Dim x As IntegerDim items As ListItemDim PortsChecked As IntegerPortsChecked = Int(Text1.Text)逐个端口检测For x = 1 To PortsCheckedLabel2.Caption = "扫描中。。。"DoEventsWinsock1.LocalPort =

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

Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<