关于我的电脑是XP的,请问如何检测计算机的端口,并且如何使它们开启或者关闭?请回答的详细一点,本人不太懂专业术语。希望各位能说的通俗易懂一些。谢谢
的问题
可以使用扫描,直接指定tcp7000
text1,ip地址
text2,起始端口
text3,终止端口
text4,信息
command1,扫描
command2,停止
添加winsock控件,
代码
Option Explicit
Dim PortNo As Long
Private Sub Command1_Click()
PortNo = CLng(Text2。
Text)
Text4。Text = “”
Command2。Enabled = True
Command1。Enabled = False
Winsock1。
Connect Text1。Text, PortNo
Me。Caption = “连接端口扫描编号:” & PortNo
End Sub
Private Sub Command2_Click()
Command1。
Enabled = True
Command2。Enabled = False
Winsock1。Close
PortNo = CLng(Text2。Text)
End Sub
Private Sub Form_Load()
Text1。
Text = “127。0。0。1”
Text2。Text = “1”
Text3。Text = “32767”
Label1。Caption = “IP 地址”
Label2。
Caption = “起始连接端口”
Label3。Caption = “终止连接端口”
Command1。Caption = “开始扫描”
Command2。Caption = “停止”
End Sub
Private Sub Winsock1_Connect()
Text4。
Text = Text4。Text & “连接端口编号:” & Str(Winsock1。RemotePort) & vbCrLf
Winsock1。Close
PortNo = PortNo + 1
If PortNo
Text) Then
Me。Caption = “连接端口扫描编号:” & PortNo
Winsock1。Connect Text1。Text, PortNo
Else
Command2_Click
End If
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, _
ByVal Scode As Long, ByVal Source As String, _
ByVal HelpFile As String, ByVal HelpContext As Long, _
CancelDisplay As Boolean)
Winsock1。
Close
PortNo = PortNo + 1
If PortNo
Connect Text1。Text, PortNo
Else
Command2_Click
End If
End Sub
。