I am using existing code, that passes data - union ibv_gid
through TCP connection without converting the endianness. There is a comment inside: "The gid will be transfer byte by byte so no need to do "hton"
. The code is correct and works, but I don't understand why the data is passed byte by byte (actually they pass the entire struct) and why there is no need in endianess convertion. The data type they pass is:
union ibv_gid {
uint8_t raw[16];
struct {
uint64_t subnet_prefix;
uint64_t interface_id;
} global;
};
** For other data types (as int etc.) they do convert the data before and after
//VL_sock_sync_data function synchronizes between the two sides
//by exchanging data between the two sides.
//size bytes are being copied from out_buf to the other side, and being saved in in_buf.
rc = VL_sock_sync_data(sock_p, sizeof(union ibv_gid), &local_gid, &tmp_gid);
Can you please explain why there is no need in endianness conversion? Thank you for any help