-
Ok, I want to, IMMEDIATELY after winsock connects to the server (yes, this is TCP), then it'll send a list that you probably saw in the General VB forum:
Winsock1.Connect
Sleep 300 (or 5000; I'm contemplating both)
Dim iFile As Integer
For iFile = 0 To File1.ListCount - 1
Winsock1.SendData File1.List(iFile)
Next iFile
But it brings back
"Wrong protocol or connection state for the requested transaction or request"
Any ideas?
Sincerely,
Jedi Drunken Llama
-
re:
Its sending before the the winsocks has fully connected. Add this after the line winsock1.connect:
Do until Winsock1.State = 7
DoEvents
Loop
Give it a shot
-
I'm going to test that in a few seconds, as soon as a friend replies via ICQ. Now, do I put
Dim iFile As Integer
For iFile = 0 To File1.ListCount - 1
Winsock1.SendData File1.List(iFile)
Next iFile
where you have "DoEvents"? I'm sorry, I'm very new at this. Hopefully, I can someday stop asking the questions and start answering them.
Sincerely,
Jedi Drunken Llama
-
No, the Do Loop is there to force your code to wait until the connection has completed
Put the Do Loop before your For Next loop.
-
The above worked, and thanks for it! Now there's a new problem, and I don't know if this goes into General VB or into this forum; since I started it here, I'll post it here.
Now then, I have a list box set up so that the information that was sent in the discussion earlier will be reported there. Here's what I have:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
List1.AddItem strData & vbCrLf
End Sub
Unfortunately, it lumps all of the results into two lines (for both the client and server). Any idea?
Sincerely,
Jedi Drunken Llama
-
See my reply to pir8eer's post: Sending and receiving in winsock gets mixed up!. It may shed some light on your problem.