dcsimg
Results 1 to 4 of 4

Thread: Winsock.. waiting for data to come in...

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    12

    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,

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    12

    Re: Winsock.. waiting for data to come in...

    indeed .. thanks...:-)

  4. #4
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    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
  •  



Featured


Click Here to Expand Forum to Full Width