42 using boost::asio::ip::tcp;
77 socket_.set_option(tcp::socket::reuse_address(
true));
81 catch (boost::system::system_error e)
83 std::cerr << e.what() << std::endl;
96 boost::function<
void(
const boost::system::error_code&,
size_t)> handler)
98 socket_.async_receive(buffer, handler);
102 boost::function<
void(
const boost::system::error_code&,
size_t)> handler)
104 socket_.async_send(buffer, handler);
void do_async_read(const boost::asio::mutable_buffers_1 &buffer, boost::function< void(const boost::system::error_code &, size_t)> handler) override
boost::asio::ip::tcp::socket socket_
static constexpr size_t WRITE_BUFFER_SIZE
boost::asio::io_service io_service_
Abstract base class for an asynchronous communication port.
void do_async_write(const boost::asio::const_buffers_1 &buffer, boost::function< void(const boost::system::error_code &, size_t)> handler) override
static constexpr size_t READ_BUFFER_SIZE
TCPClient(std::string host=DEFAULT_HOST, uint16_t port=DEFAULT_PORT)
Connect to a TCP socket as a client.
boost::asio::ip::tcp::endpoint endpoint_