I am using a winsock control to make a telnet control.

My problem is, i can not tell when data arrival has recieved all the data back, for it seems that TCP returns data in chunks. I wish there was a dataarrival complete, does anyone here know how to help me?

Code:
    Dim i As Long
    Dim j As Integer
    Dim Wait As Double
    
    Do While Not SEND_COMPLETE
        DoEvents
    Loop
        
    ' Clear flag to indicate send is not complete
    SEND_COMPLETE = False
      
    i = VBControls.lstHostOutput.ListCount
    HOST_IMAGE_INCOMPLETE = True
    
    VBControls.tcpClient.SendData strString
    
    Wait = Now + SecondsToWait / (3600# * 24#)
    
    Do Until (SEND_COMPLETE) Or (Now > Wait)
        DoEvents
    Loop
    
    CommandError = False
    
    'If Now > Wait Then
    '    CommandError = True
    'End If
    HOST_IMAGE_INCOMPLETE = True
    
    Do While HOST_IMAGE_INCOMPLETE
        DoEvents
    Loop
    
    LineCount = VBControls.lstHostOutput.ListCount - i
    For j = 0 To LineCount - 1
        OutputLines(j + 1) = VBControls.lstHostOutput.List(i + j)
    Next j
This works if I just one break point in, even if I just hit F5 and let my program continue simulation. It fills out my array nicely, but if I run with no break points all this finishes before say data_arrival has recieved the data back.