networking · beginner · ~15 min
Reassemble a 16-bit big-endian port.
A port is stored big-endian in sockaddr. Implement int port_from_be(unsigned char hi, unsigned char lo) returning the port value (hi << 8 | lo).
int port_from_be(unsigned char hi, unsigned char lo) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.