Allow binding to a random port.

In TCP, binding to port 0 means asking the OS to choose an available
ephemeral port to bind to. In this case, network-transport-tcp
erroneously thinks the address is then "host:0", which has no meaning to
any peer.

This patch fixes the situation, by querying what port was obtained from
the OS before constructing the endpoint address.