|
-
Oct 3rd, 2009, 07:10 AM
#1
Thread Starter
New Member
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,
-
Oct 3rd, 2009, 11:10 AM
#2
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
-
Oct 3rd, 2009, 03:05 PM
#3
Thread Starter
New Member
Re: Winsock.. waiting for data to come in...
-
Oct 4th, 2009, 06:44 PM
#4
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.
Tags for this Thread
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
|