Here is my code:
Client
Position pos(1.0,2.0,0.45); feedback feed(12, pos, 100); msgpack::sbuffer sbuf; msgpack::pack(sbuf, feed); int test = write(tcp_client.sockfd, sbuf.data(),sizeof(sbuf));
Server :
char* buffer = new char[41]; int test = recv(TCP_server.newsockfd, buffer, 40, MSG_WAITALL ); for (int i=0; i< sizeof(buffer); i++) std::cout << std::hex << (int)buffer[i] << " "; std::cout << std::endl;
For the other parts of the codes, connection is established and data has been transmitted successfully.
The problem now is that I got the following output :
Client :
ffffff94 b c ffffff93 ffffffca 3f ffffff80 0 0 ffffffca 40 0 0 0 ffffffca 3e ffffffe6 66 66 64
Server :
ffffff94 b c ffffff93 ffffffca 3f ffffff80 0
Is there any reason why received data stopped after encountering the first 0x0000 char? when I send a string, everything works fine but not in this specific case.
For the records, the recv() doc doesn't help much...