谁帮我看看这个 winsock 为什么无法连接
这个连接总是出现“40020错误,当前状态的操作无效”
Winsock.zip
(2.65 KB)
请大家帮我看看,这到底是怎么回事!谢谢了!
Private Sub Command1_Click()
Command1.Enabled = False
Winsock2.RemoteHost = "192.168.1.101"
Winsock2.RemotePort = 1001
Winsock2.Connect "192.168.1.101"
End Sub
Private Sub Command2_Click()
Winsock2.SendData Text2.Text
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 1001
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim TmpStr As String
Winsock1.GetData TmpStr
Text1.Text = TmpStr
End Sub
Private Sub Winsock2_Connect()
Command2.Enabled = True
End Sub
Private Sub Winsock2_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)
Command1.Enabled = True
Command2.Enabled = False
End Sub