Better handling of port 0

Usually port 0 means that the OS should pick any free port. After
listen() has been called the picked port can be determined and used
from then on.