|
-
May 1st, 2001, 11:20 PM
#1
Thread Starter
New Member
Binary Data with Winsock GetData
I am trying to receive binary data via UDP using the Winsock control's GetData method within the DataReceived event procedure. When I use a string variable to receive text, my program works. But when I use a byte array, no data is placed in the byte array.
Here is the code for receiving into a string:
Dim a as String
WinsockCtl.GetData(a)
MsgBox(a) ' displays received data
For the byte array:
Dim b(1024) as Byte
WinsockCtl.GetData(b, vbByte + vbArray)
' all elements of b contain zero
What am I doing wrong?
Thanks
-
May 1st, 2001, 11:42 PM
#2
Thread Starter
New Member
I solved my own problem on this one. The byte array needs to be a dynamic array that is redimensioned to the length of the received data. If the receiving variable is not equal to the length of the received data, GetData returns no data.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|