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