Port number printed without ntohs

A client connects from source port 5000 to a server running on a little-endian x86 host. The server logs the client's port by printing the sin_port field of the sockaddr_in filled in by accept() as an unsigned 16-bit integer, but it forgets to call ntohs(). What number does the log show? Give your answer as an exact integer.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Socket Communication Questions: