I have java language experence. If I need parse a binary tcp packet . like following format
encoded string and send it to peer by tcp
1byte msg type + 4 byte(unsigned int) + raw byte(body)
To parse this package , Some Java code like this:
byte[] data = new byte[1024];
Bytebuf buf = new ByteBuf(data)
byte type = buf.read()
int len = buf.ReadInt()