I searched char* to hex string before but implementation I found adds some non-existent garbage at the end of hex string. I receive pa
You can try this code for converting bytes from packet to a null-terminated string and store to "string" variable for processing.
const int buffer_size = 2048;
// variable for storing buffer as printable HEX string
char data[buffer_size*2];
// receive message from socket
int ret = recvfrom(sock, buffer, sizeofbuffer, 0, reinterpret_cast(&from), &size);
// bytes converting cycle
for (int i=0,j=0; i
When we send message with hex bytes 0x01020E0F, variable "data" had char array with string "01020e0f".