eidheim / Simple-Web-Server

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
MIT License
2.61k stars 751 forks source link

Splitted the start function into a two in order to access the bound port #221

Closed tkarls closed 6 years ago

tkarls commented 6 years ago

This is relevant if binding on a random free port (0) and since start never returns... we need a split function to safely get it

The old start() function is left calling my splitted functions for backwards compatibility and simplicity when you do know the port in advance.

I needed this for my project and thought I should share it in case it is deemed an acceptable solution to the problem of getting the port.

eidheim commented 6 years ago

Thank you for looking into this and posting this PR. I'll look into this further during the weekend, but the final solution might look similar to this.

tkarls commented 6 years ago

Great :) Yes, feel no obligation to use this version. I'm not that familiar with this code base and just made what I needed. There might be "prettier" ways to handle it.

eidheim commented 6 years ago

Sorry for the delay, I'm going to need a couple more days on this. Just letting you know I have not forgotten about this PR:)

eidheim commented 6 years ago

Finally got around to it. I did some changes though, feedback is welcome. Thank you again.

tkarls commented 6 years ago

Great, thanks 👍