Suppose I create a very simple socket connection, how can one programatically:
a. After a connection is established, most socket APIs have a call for something like "getLocalAddress" that will tell you the interface that the OS selected for you.
b. Similarly, after a socket is created but before a connection is established, most socket APIs have a call to bind the socket to a local address and/or port.