|
-
Apr 3rd, 2005, 12:12 PM
#1
Thread Starter
Junior Member
Please help me with this very simple winsock problem!!
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
-
Apr 3rd, 2005, 12:34 PM
#2
Thread Starter
Junior Member
Re: Please help me with this very simple winsock problem!!
no need, i figured it, I replaced the IP with the machine name and it worked
-
Apr 3rd, 2005, 12:56 PM
#3
Hyperactive Member
Re: Please help me with this very simple winsock problem!!
If your testing it on the same computer, you can use your loopback IP which is 127.0.0.1 as the remote host.
If my post was helpful please rate it 
-
Apr 3rd, 2005, 09:24 PM
#4
Re: Please help me with this very simple winsock problem!!
Or just:

Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|