home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,052 of 10,840   
   Henning to All   
   SV: SV: Winsock what did I miss?   
   05 Dec 04 01:32:08   
   
   From: computer_hero@coldmail.com   
      
   Anyone to bet a dollar on Steve?   
   He is right!   
   When I saw the reply, I simply hit myself hard!   
   Thx Steve for pointing that out, it works like a dream now!   
   Thx again   
   /Henning (in computers since 1979)   
      
   "Steve Gerrard"  skrev i meddelandet   
   news:9KadnQ1S6oshpi_cRVn-2Q@comcast.com...   
   >   
   > "Shell" <___computerNOSPAMconsultant@mindspring.com___> wrote in message   
   > news:oia4r0dirualqagflt1bm9ijvi9spdjvn8@4ax.com...   
   > | >| When receiving to a string, it works.   
   > | >| So, the quiz stands. What have I missed when trying the byte array.   
   >   
   > | >| Private Sub Wsock_DataArrival(ByVal bytesTotal As Long)   
   > | >|   Dim byteData(256) As Byte   
   > | >   
   >   
   > | >I suspect that GetData is expecting a dynamic array, which it can   
   > resize   
   > | >to fit the data. So just doing   
   > | >    Dim byteData() As Byte   
   > | >might do it.   
   >   
   > | No sir, the GetData is somewhat like the Get/Input statements.  They   
   > | require "sizing" to the amount of data to be received, and a ByteArray   
   > | is just fine for this purpose.   
   > |   
   >   
   > 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.   
   >   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca