networking · intermediate · ~15 min
Deserialise a 16-bit value from network order.
Implement unsigned short ntohs_bytes(const unsigned char *in) reading two big-endian bytes back into a 16-bit host value.
unsigned short ntohs_bytes(const unsigned char *in) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.