buildAndListen

open fun buildAndListen(port: Int): Int

Build and listen on the specified port.

NOTE: this method will block for opening the socket and reserving the port. If you need a non-blocking variant, manually build the server and start listening it.

Return

The listening port


open fun buildAndListen(): Int

Build and listen on the port specified by the environment variable PORT, or alternatively on the default 9080 port.

NOTE: this method will block for opening the socket and reserving the port. If you need a non-blocking variant, manually build the server and start listening it.

Return

The listening port