Ole Christian Eidheim
Ole Christian Eidheim
Regarding a thread pool of size 30, here is a simplified example of how I would implement this using asio: ```c++ #include "server_http.hpp" class Workers { public: boost::asio::io_service service; private:...
I get `terminating with uncaught exception of type boost::exception_detail::clone_impl: bind: Address already in use`, but what OS are you running the server on?
I know there are some problems with exceptions on Windows, had the problems related to another project I'm working on (https://github.com/cppit/jucipp), but I have not had time to dive into...
Try add the following inside the ServerBase constructor (https://github.com/eidheim/Simple-Web-Server/blob/master/server_http.hpp#L156): ``` boost::asio::ip::tcp::acceptor::reuse_address option(false); acceptor.set_option(option); ```
See if you can make sense of http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t/14388707#14388707. If your node server and the Simple-Web-Server uses exactly the same ip:port combination you should get an exception no matter if reuse_address...
I will, by the way, add another constructor most likely, that has the address as first parameter. So that this becomes simpler, and one can run this server on multiple...
I'll commit a solution for the things discussed above Tomorrow, using a Server::options class that one can set before running Server::start. One of the options will be reuse_address that will...
Did you try the latest commit? Boost::Asio is very picky on where you set the options.
I will have to read up on this some more, but as I understand it now: On Windows, if Server::config.reuse_address == false, also set the SO_EXCLUSIVEADDRUSE socket option?
From what I can understand from http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t/14388707#14388707: "Microsoft realized that this might be a problem and thus added another socket option SO_EXCLUSIVEADDRUSE", you need to set SO_EXCLUSIVEADDRUSE on the node...