vb.net - Better way to read data from a network stream -
i'm relatively new vb , have written program receives message packets server.
the packets start same 4 bytes , length of package 5th byte. packets end same 4 bytes , vary in size.
using networkstream.read()
not suitable missing data packets sent if read in middle of message
a sample of packets byte array
{161, 178, 195, 212, 10, 0, 94, 77, 60, 43}
this simplified byte arrays each packet can on 7000 bytes long.
what looking best way full packet server sends can decode it.
here read function
public function read(tcpclient tcpclient) dim readbytes(15000) byte networkstream = tcpclient.getstream() if networkstream.dataavailable networkstream.read(readbytes, 0, readbytes.length) end if return readbytes end function
wiki
Comments
Post a Comment