Linux network programming print receiving packets

92 2

After the server receives packets transmitted through udp, it prints out.

printf("%02x",buff);

Buff is a char array and is large enough for server to parse, but the resulting result isn't the same.

00 11 22 33 45 56 aa ab
98 ff fe a2 d3 25 78 c6
f2 ffffffd3 ffffffc4 11 22 33 44 55
...

Clearly, d3---> ffffffd3, c4---> ffffffc4.
What's this? thank you.

1 Answers

55 0

What's the content in the packet, that's, 00 11 22 33, such data is the client itself. A string of f is likely to be a problem with data type conversion, such as the data that's originally unsigned char, and server receives the stored as char type, which can be

...