esert
April 3rd, 2001, 03:47 PM
I am using a winsock control, set to UDP. When I recieve data using the GetData event, can I receive a bytearray and then from that byte array -- pull out the items such as an int, bool, string... if so, how do I do that using vb.
Thanks.
cksiow
April 3rd, 2001, 07:17 PM
I am not sure why you need to use bytearray anyway. Because you can use string variable and pull out data from individual byte using the mid function.
for instance,
dim s as string
winsock1.GetData S
from here, you can get the individual byte of S using mid(s,i,1) where i is the index. if you want the ascii of it, use ASC function.
of course, you need to know how to decode the data that you received into meaningful data to you program. e.g. if the first two byte of the data if a int value then you can do this
dim l as integer
l = asc(mid(s,1,1)) * 256 + asc(mid(s,2,1))
and of course you need to test the signed bit as well.
hope this help.
cksiow
http://vblib.virtualave.net - share our codes