Winsock.GetData how to declare storage for data? 
Author Message
 Winsock.GetData how to declare storage for data?

          I do not know how to declare the storage for data obtained from
WinSock method GetData()
From MSDN:
object.GetData data, [type,] [maxLen]
      data Where retrieved data will be stored after the method returns
successfully. If there is not enough data available for requested type, data
will be set to Empty.

      type Optional. Type of data to be retrieved, as shown in Settings.

Using Winsock (TCP protocol, local port) my code is receiving the raw audio
stream  which I want to analyze, after receiving the full 32 kbytes of data.
Also, what should I select for type:
vbByte, vbInteger ,vbArray + vbByte or just maybe vbString?

Please see my code below. I feel uneasy to use Copy Memory and copying a

Dim tempMemLen As Long
Dim tempMem(34000) As Byte

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
   Dim sData As String
    Winsock1.GetData sData, vbString
    CopyMemory tempMem(tempMemLen), sData, bytesTotal
    tempMemLen = tempMemLen + bytesTotal
    If Winsock1.BytesReceived >= 32000 Then
       ----------  analyze -----
    End If

End Sub

Should I collect data into Byte or Integer array? I need to analyze it for
the EnergyLevel (to detect silence).

Thank you for comments,

Fri, 19 Aug 2011 06:47:51 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Winsock DataArrival, socket closing and can't GetData before receiving all the data

2. Lost data with VB Winsock control and UDP GetData

3. Winsock.ocx | After GetData, DataArrival gets fired immediatelly (loop)

4. winsock GetData

5. problem with winsock getdata

6. winsock.GetData

7. Winsock GetData, bytes and variants

8. SOLUTION to 8K Winsock GetData problem

9. Winsock (Getdata into an array of byte)

10. GetData() Method Question, Winsock Control 5.0

11. Winsock Control - Getdata does not get 100% of message

12. Winsock GetData Concantenation


Powered by phpBB® Forum Software