10#include <FMEThirdPartyWarningsDisable.h>
11#include <boost/asio/ip/tcp.hpp>
13#include <FMEThirdPartyWarningsRestore.h>
46 template<
typename ConnectCompletionHandler>
49 using DnsQuery = boost::asio::ip::tcp::resolver::query;
53 auto query =
DnsQuery(host ==
"localhost" ?
"127.0.0.1" : host, std::to_string(port));
54#if defined(MLAB_CMAKE_BUILDSYSTEM)
57#if BOOST_VERSION >= 107000
58#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
60#define GET_IO_SERVICE(s) ((s).get_io_service())
65 auto resolver = std::make_shared<TcpResolver>(socket.get_io_service());
72 socket.async_connect(iterator->endpoint(), handler);
#define ASYNCHRONOUSIO_EXPORT
Abstract base class for an asynchronous channel supporting read and write of binary data.
std::function< void(const ErrorCode &, const std::size_t)> CompletionHandler
A TCP acceptor listening on a given port and interface address.
A TCP socket class implementing the asio::Socket interface.
std::shared_ptr< Context > context
void async_write(const void *buffer, const std::size_t buffer_size, const CompletionHandler &handler) override
void async_connect(const std::string &host, const unsigned short port, ConnectCompletionHandler &&handler)
TcpSocket(const TcpSocket &)=delete
void async_read(void *buffer, const std::size_t buffer_size, const CompletionHandler &handler) override
boost::asio::ip::tcp::socket socket
TcpSocket & operator=(const TcpSocket &)=delete
TcpSocket(std::shared_ptr< Context > context)
bool is_valid() const override
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
boost::system::error_code ErrorCode