Which socket function associates a socket with a specific local IP address and port number?

Options

  • A. bind()
  • B. listen()
  • C. accept()
  • D. recv()
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. bind()

Detailed Explanation

Correct Answer: bind().

The bind() system call assigns a local IP address and port number to a socket. It is commonly used by servers to associate themselves with a specific port.