vb winsock 实时错误“40006” 所需事物请求的错误协议连接或连接状态。我检查了好几遍不知道怎么错了。
PrivateSubCommand1_Click()Winsock2.ConnectEndSubPrivateSubCommand2_Click()Winsock1.Se...
Private Sub Command1_Click()
Winsock2.Connect
End Sub
Private Sub Command2_Click()
Winsock1.SendData "ok"
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 12345
Winsock1.Listen
Winsock2.RemoteHost = "127.0.0.1"
Winsock2.RemotePort = 12345
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
MsgBox " clent connect "
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
MsgBox " receive data"
End Sub
Private Sub Winsock2_Connect()
MsgBox "ok"
End Sub 展开
Winsock2.Connect
End Sub
Private Sub Command2_Click()
Winsock1.SendData "ok"
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 12345
Winsock1.Listen
Winsock2.RemoteHost = "127.0.0.1"
Winsock2.RemotePort = 12345
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
MsgBox " clent connect "
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
MsgBox " receive data"
End Sub
Private Sub Winsock2_Connect()
MsgBox "ok"
End Sub 展开
2个回答
展开全部
Private Sub Command1_Click()
Winsock2.Connect
End Sub
Private Sub Command2_Click()
Winsock2.SendData "ok"
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 12345
Winsock1.Listen
Winsock2.RemoteHost = "127.0.0.1"
Winsock2.RemotePort = 12345
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim a As String
Winsock1.GetData a
msgbox a
End Sub
Private Sub Winsock2_Connect()
MsgBox "ok"
End Sub
Winsock2.Connect
End Sub
Private Sub Command2_Click()
Winsock2.SendData "ok"
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 12345
Winsock1.Listen
Winsock2.RemoteHost = "127.0.0.1"
Winsock2.RemotePort = 12345
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim a As String
Winsock1.GetData a
msgbox a
End Sub
Private Sub Winsock2_Connect()
MsgBox "ok"
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询