Implement support for dynamically chosen port numbers