Ok it has taken me a while but i came up with the following:
Dim stream As New MemoryStream(st ate.buffer)
Dim data As New IO.BinaryReader (stream)
ConWrite(data.R eadInt16)
The first 2 bytes send are definately 00 02... so readint16 should return 2.. but it returns 512! How is that possible?
User Profile
Collapse
-
sorry for the double post.. but i couldn't edit mine anymore.. I found some threads on serialization. But the problem is, that the packets dont have a standard size.. i cant use a "struct" as that would be called in c (type in vb i believe). I have to read the first integer, and based on that i can read the rest of the packet (the first integer describes what kind of packet it is, each packetnumber has a different structure)Leave a comment:
-
Read binary data from a byte array
I'm not sure how to describe this, but i have a socket receiving data.
handler.BeginRe ceive(state.buf fer, 0, StateObject.Buf ferSize, 0, New AsyncCallback(A ddressOf ReadCallback), state)
(there's way more code offcourse.. but basicly my byte array buffer gets filled up all the time when a packet is received)
This data is put in a byte array. But this data is not ascii... it's binary. I need to read different...Last edited by robindegen; Jul 27 '06, 01:26 PM.
No activity results to display
Show More
Leave a comment: