i have some problems to understand the following:
I will implement a real small protocol in C. For negotiation server and client have to exchange information via hex values.
When I answer the request from the client I send following array:
char array[] = { 0x00, 0x02, 0x01, 0x2F, 0x02 }
The calculated length with sizeof(array) is 5. For debugging purposes I did a printf of the array.
for( i = 0; i < length; i++ ){
printf("%x", *(array + i));
}
The output is 0212F2. How the client knows which values belongs together? There are more possiblities, aren't there? Maybe 0x00, 0x21, 0x02, 0x0F, 0x02, but that is not correct.
Can someone explain this?
Thanks a lot:)
Florian