fix code for reuse addr on asio client

This commit is contained in:
Alexandros Konstantinakis-Karmis 2018-08-27 10:53:14 +03:00
parent d24527e7e6
commit 9a2e38e058
1 changed files with 2 additions and 1 deletions

View File

@ -40,7 +40,8 @@ session_tcp_impl::session_tcp_impl(
const std::string &host, const std::string &service,
const boost::posix_time::time_duration &connect_timeout)
: session_impl(io_service, connect_timeout),
socket_(io_service, tcp::v4()) {
socket_(io_service) {
socket_.open(local_endpoint.protocol());
boost::asio::socket_base::reuse_address option(true);
socket_.set_option(option);
socket_.bind(local_endpoint);