Parsing package

Howdy folks,

I’m currently writing something and i got stuck.

I’m suppose to parse a package and get the length of it and then retrieve the rest of the data.

Except i somehow can’t get the package to be parsed correctly.

The full client bitstream (except the filling zero’s behind)


I need to parse the last package (08 … 38)

I created a struct at the top of the page

uint8 length;
uint32 data;
} sAuthLogonAuthenticate_C;
After this inside the void i want to get the length

sAuthLogonAuthenticate_C lp;

if (!socket().recv((char *)&lp, sizeof(sAuthLogonAuthenticate_C)))
    return false;

std::vector<uint8> buf;

socket().recv((char *)&buf[0], 2);


sLog->outDebug(LOG_FILTER_AUTHSERVER, “Length: %#04x”, buf[0]);

I want to retrieve the length (08) and then the following bits after that according the length (31-32-33-34-35-36-37-38)

What am i doing wrong ?

Was thinking a bit to stupid here, at the line

if (!socket().recv((char *)&lp, sizeof(sAuthLogonAuthenticate_C)))
return false;

It’s loaded into lp, so i can get the length just by doing lp.length /emoticons/default_smile.png

But it’s still unclear to get the data (31-32-33-34-35-36-37-38) since is NULL.

Hope somebody can help me out here.

Read it by parts, first read the uint8 and then read [length] bytes.