Winsock.. waiting for data to come in...
Hi,
Like stated in a previous post, i'm very new to VB6.
Now... I'm coding a login sequence with winsock and i have the following problem...
Code:
Private Sub Command1_Click()
Dim LF As Integer
LF = RconLogin()
while len(wskin)=0
wend
End Sub
I call a function called RconLogin and after that i should received a string back in wskin thru winsock.dataArrival.
As you see i got a while wend loop for waiting data to become available but when i run this the code run into a dead loop...
I know this is very noobish but anyone can help me on this ?
Thanks,
My DataArrival store a string in a var call WskIn,
Re: Winsock.. waiting for data to come in...
The DataArrival event won't occur because your program is busy processing the While Loop. Although it is not clear why you have the loop simply adding a DoEvents statement should solve the problem.
Code:
while len(wskin)=0
DoEvents
wend
Re: Winsock.. waiting for data to come in...
Re: Winsock.. waiting for data to come in...
No need for a loop at all. That's why Winsock is asynchronous and provides events.
Just remove the loop and put the code in the _DataArrival event.