It's probably hex values over 0x7F. The sign bit is being stripped somehow; probably on the receiving end; possibly by string::data() (I haven't tested with std::string so I don't know if the data() member might be stripping the sign bit).
The problem is simple, Char is -128 to 127... if i send HEX 79 i recive HEX 79, but if i send HEX 80 i recive 00... HEX 79 is DEC 127, so Char limit is 127. Is an UTF problem, encoding problem.
The function SEND, expect a Char as a second parameter, and i dont know too much C.
I been trying with String.data() or String.c_str() but is the same... i need some kind of Socket that let me send this data, with unsigned char parameter or string, but i dont know if exist another way.
It's not the socket. Like Richard.J said, send() and recv() don't care what your sending as long as it can be represented by a stream of bytes. Something else either before send() on one end, or after recv() on the other end is stripping the sign bit.
remove any std::string (or else) and use array of BYTE type in send and in receive functions.
My gues is that std::string mess up your data.
For receive allocate BYTE array and receive data in it.
As others say, this should work pretty good :
for send :
for receive :
int rcv_bytes = recv(sock, info_recv, 2000, /* MSG_WAITALL */ or 0);
It is good also if you organize some header of each packet of data you send. With at least bytes expected inside. So receiver will know what length to expect.
Keep in mind that you may need to call recv() several times before to receive whole data that is send.
i.e. you may (and will) receive your data on several chunks, or 2 or more whole packets can be received at once.
So you should organize some Q of received data and at each completion of recv() to add data to this Q...then if whole packet (completely defined by you) is received, process it, remove ONLY bytes of processed packet from this Q...and continue to wait for next packets.