vb中怎么对某个ip的端口扫描
text里输入某个ip后点击按钮后对这个ip的端口扫描----应该就这样在编写过程中遇到问题,求高手帮忙
'本地不可用 Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Delay(PauseTime As Long) '防止假死 Dim Start As Single Start = Timer * 1000 Do While Timer * 1000 < Start + PauseTime Sleep (1) DoEvents Loop End Sub Private Sub Command1_Click() Dim i As Long Winsock1.Close Winsock1.RemoteHost = Text1.Text '要扫描的IP For i = 0 To 65536 '端口号只有整数,范围是从0 到65535(2^16-1) Winsock1.RemotePort = i Winsock1.Connect Delay 500 If Winsock1.State = 7 Then '连接是否成功 List1.AddItem i End If Next End Sub