Using snap-server’s httpServe method, I can setPort 0 to instruct the server to connect on the next free port. Unfortunately, once I have started the http server, I can’t find any way to determine which port it actually started on. As an example, my first try started on port 2679 – is there any way to determine that number?
Using snap-server’s httpServe method, I can setPort 0 to instruct the server to connect
Share
I wrote this patch, included with
snap-server0.9 and above, using which you can write:Now
hookwill be called after the server is ready, and will print the port it started on.