Themuppeteer
Programmer
I've typed the msdn example about winsocks, it gives me
"Runtime error '40026':
Wrong protocol or connection state for the requested
transaction or request"
I followed exactely the msdn to create it.
Can anyone help me ?
Here's the code...
SERVER
-------
Private Sub Form_Load()
'Winsock1.Protocol = sckTCPProtocol
tcpServer.LocalPort = 1001
tcpServer.Listen
frmClient.Show
End Sub
Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long)
If tcpServer.State <> sckClosed Then
tcpServer.Close
tcpServer.Accept requestID
End Sub
Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
tcpServer.GetData strData
txtOutput.Text = strData
End Sub
Private Sub txtSendData_Change()
tcpServer.SendData txtSendData.Text
End Sub
CLIENT
------
Private Sub cmdConnect_Click()
tcpClient.Connect
End Sub
Private Sub Form_Load()
tcpClient.RemoteHost = "The muppet"
tcpClient.RemotePort = 1001
End Sub
Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
tcpClient.GetData strData
txtOutput.Text strData
End Sub
Private Sub txtSend_Change()
tcpClient.SendData txtSend.Text
End Sub
"Runtime error '40026':
Wrong protocol or connection state for the requested
transaction or request"
I followed exactely the msdn to create it.
Can anyone help me ?
Here's the code...
SERVER
-------
Private Sub Form_Load()
'Winsock1.Protocol = sckTCPProtocol
tcpServer.LocalPort = 1001
tcpServer.Listen
frmClient.Show
End Sub
Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long)
If tcpServer.State <> sckClosed Then
tcpServer.Close
tcpServer.Accept requestID
End Sub
Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
tcpServer.GetData strData
txtOutput.Text = strData
End Sub
Private Sub txtSendData_Change()
tcpServer.SendData txtSendData.Text
End Sub
CLIENT
------
Private Sub cmdConnect_Click()
tcpClient.Connect
End Sub
Private Sub Form_Load()
tcpClient.RemoteHost = "The muppet"
tcpClient.RemotePort = 1001
End Sub
Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
tcpClient.GetData strData
txtOutput.Text strData
End Sub
Private Sub txtSend_Change()
tcpClient.SendData txtSend.Text
End Sub