winsock通讯 错误连接状态
Private Sub Command1_Click()Dim a As String, b As String
a = "1234567"
Winsock1.SendData a
Winsock1.GetData b, vbString
MsgBox b, vbInformation + vbOKOnly, "提示"
End Sub
Private Sub Form_Load()
set0.Show
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.RemoteHost = set0.IP
Winsock1.RemotePort = set0.DK
Winsock1.Protocol = 0 ' TCP 协议
Winsock1.LocalPort = 0
Winsock1.Connect
End Sub
set0代码
Public IP As String, DK As Long
Private Sub Command1_Click()
IP = Text1.Text
DK = Text2.Text
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
运行时Winsock1.SendData a
Winsock1.GetData b, vbString
均会报错:
实时错误40006 所请求的事务或请求本身的错误协议或者错误连接状态