in some other consolenc localhost 50052 killall -9 rpc-server If you try to startrpc-serveragain (withoutSO_REUSEADDR), it will fail. With this patch, it will start successfully.
acceptor_.set_option(boost::asio::socket_base::reuse_address(true), ec); if(ec) { fail(ec, "set_option"); return; } works perfectly, so yes adding the reuse option seems to fix it (for me at least). Maybe you could consider adding this to the examples on boost.org as it isn...
In the socket code for Windows, we had removed the SO_REUSEADDR option, because we had noticed that it would cause unsafe reuse of listen ports. When Tony showed me code for the inet_driver, I saw that it used SO_REUSEADDR on all platforms and I told him that he would have to take...
Package greuse provides Listen and Dial functions that set socket options in order to be able to reuse ports. You should only use this package if you know what SO_REUSEADDR and SO_REUSEPORT are. Installation go get -u -v github.com/gogf/greuse ...