From 47d84c012f16f10d92634d8940f171bef7397a7e Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 13 Jan 2004 02:03:38 +0000 Subject: [PATCH] Allow reuse of the port. --- asio/src/tests/performance/server.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/asio/src/tests/performance/server.cpp b/asio/src/tests/performance/server.cpp index c2c8a906..7d4389e7 100644 --- a/asio/src/tests/performance/server.cpp +++ b/asio/src/tests/performance/server.cpp @@ -109,9 +109,14 @@ class server public: server(demuxer& d, short port, size_t block_size) : demuxer_(d), - acceptor_(d, ipv4::address(port)), + acceptor_(d), block_size_(block_size) { + acceptor_.open(ipv4::tcp()); + acceptor_.set_option(socket_option::reuse_address(1)); + acceptor_.bind(ipv4::address(port)); + acceptor_.listen(); + session* new_session = new session(demuxer_, block_size_); acceptor_.async_accept(new_session->socket(), boost::bind(&server::handle_accept, this, new_session, _1));