From: ___computerNOSPAMconsultant@mindspring.com___   
      
   In responce to the post:   
    On Sat, 4 Dec 2004 14:35:41 -0800, "Steve Gerrard"   
    stated...and I replied:   
      
   >   
   >Good theory, but in fact incorrect. The examples in MSDN use unsized   
   >strings, for instance, to receive text data, which gives a hint.   
   >   
   >The following does work for receiving 4 bytes of data:   
   >   
   >Private Sub Winsock3_DataArrival(ByVal bytesTotal As Long)   
   > Dim bytes() As Byte   
   > Dim n As Integer   
   >   
   > Winsock3.GetData bytes, vbArray + vbByte   
   > For n = LBound(bytes) To UBound(bytes)   
   > Debug.Print n, bytes(n)   
   > Next n   
   >   
   >End Sub   
   >   
   >If you replace the Dim statement with   
   > Dim bytes(0 to 3) As Byte   
   >   
   >the bytes will remain all zero.   
   >   
      
   Duh (to myself), you are in fact right. It's been over 3 years since   
   I programmed with the winsock control. I also remember that the   
   GetData function does not always get ALL the data. It, at times, must   
   be called many times to receive the full data stream. In fact, I've   
   had it called thousands of times to pass large files, with DoEvents   
   stuffed in to avoid the potential timeout problems.   
      
   Regards,   
   Shell   
   -   
   http://drshell.home.mindspring.com/   
   Into computers since 1972.   
   WARNING! Information and e-mail addresses contained herein, are for personal   
   use only. By entering this site, you agree that you will use this data only   
   for lawful purposes and that, under no circumstances will you use this data   
   to: allow, enable, or    
   otherwise support the transmission of mass unsolicited, commercial advertising   
   or solicitations via direct mail, electronic mail, or by telephone. Violators   
   will be dealt with accordingly.   
   -   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|