thejoker
Apr 3rd, 2005, 12:12 PM
Hi,
I need to build a very simple application. What is required to test both the client and server applications on the same PC? I am running Windows XP with Visual Basic 6 SP 6.
The code for the simple client and server programs is as follows, but for some reason I get the error: runtime error 40006: wrong protocol or connection state for the requested transaction or request.
The code:
The Server app:
Private Sub Form_Load()
Winsock1.LocalPort = 1000
Form1.Caption = Winsock1.LocalIP
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
Winsock.Accept requestID
End If
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData strData, vbString
Form1.Print strData
End Sub
The client app:
Private Sub cmdSendhello_Click()
Winsock1.SendData "hello"
End Sub
Private Sub Command1_Click()
Winsock1.RemotePort = 1000
Winsock1.RemoteHost = "192.168.1.3"
Winsock1.Connect
End Sub
I need to build a very simple application. What is required to test both the client and server applications on the same PC? I am running Windows XP with Visual Basic 6 SP 6.
The code for the simple client and server programs is as follows, but for some reason I get the error: runtime error 40006: wrong protocol or connection state for the requested transaction or request.
The code:
The Server app:
Private Sub Form_Load()
Winsock1.LocalPort = 1000
Form1.Caption = Winsock1.LocalIP
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
Winsock.Accept requestID
End If
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData strData, vbString
Form1.Print strData
End Sub
The client app:
Private Sub cmdSendhello_Click()
Winsock1.SendData "hello"
End Sub
Private Sub Command1_Click()
Winsock1.RemotePort = 1000
Winsock1.RemoteHost = "192.168.1.3"
Winsock1.Connect
End Sub