Skip to content

Expected behavior of getsockname for unbound socket #76

Discussion options

You must be logged in to vote
  1. What should getsockname return for unbound socket input, considering future PA3 too? Success (0) vs Error (-1)
  2. What should getsockname set on the given addr input for unbound socket input? Can it just skip setting addr?

Unbound socket would return INADDR_ANY (0.0.0.0) and zero for return value, and the result will not used in the PA3.

  1. If connection is established without user's bind call, should getsockname return the address that system (i.e. KENS) arbitrarily assigned?

For the connected sockets, an address in 5-tuple is returned.

If you're curious about the specific behavior of a system call, you can try it on a Linux machine.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by metamon123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants