unilink  0.4.3
A simple C++ library for unified async communication
unilink::wrapper::TcpClient Class Reference

Modernized TCP Client Wrapper. More...

#include <tcp_client.hpp>

Inheritance diagram for unilink::wrapper::TcpClient:
unilink::wrapper::ChannelInterface

Classes

struct  Impl
 

Public Member Functions

 TcpClient (const std::string &host, uint16_t port)
 
 TcpClient (const std::string &host, uint16_t port, std::shared_ptr< boost::asio::io_context > external_ioc)
 
 TcpClient (std::shared_ptr< interface::Channel > channel)
 
 ~TcpClient () override
 
 TcpClient (TcpClient &&) noexcept
 
TcpClientoperator= (TcpClient &&) noexcept
 
 TcpClient (const TcpClient &)=delete
 
TcpClientoperator= (const TcpClient &)=delete
 
std::future< bool > start () override
 
void stop () override
 
void send (std::string_view data) override
 
void send_line (std::string_view line) override
 
bool is_connected () const override
 
ChannelInterfaceon_data (MessageHandler handler) override
 
ChannelInterfaceon_connect (ConnectionHandler handler) override
 
ChannelInterfaceon_disconnect (ConnectionHandler handler) override
 
ChannelInterfaceon_error (ErrorHandler handler) override
 
ChannelInterfaceauto_manage (bool manage=true) override
 
TcpClientset_retry_interval (std::chrono::milliseconds interval)
 
TcpClientset_max_retries (int max_retries)
 
TcpClientset_connection_timeout (std::chrono::milliseconds timeout)
 
TcpClientset_manage_external_context (bool manage)
 

Additional Inherited Members

Detailed Description

Modernized TCP Client Wrapper.

Definition at line 46 of file tcp_client.hpp.

Constructor & Destructor Documentation

◆ TcpClient() [1/5]

unilink::wrapper::TcpClient::TcpClient ( const std::string &  host,
uint16_t  port 
)

Definition at line 229 of file tcp_client.cc.

◆ TcpClient() [2/5]

unilink::wrapper::TcpClient::TcpClient ( const std::string &  host,
uint16_t  port,
std::shared_ptr< boost::asio::io_context >  external_ioc 
)

Definition at line 230 of file tcp_client.cc.

◆ TcpClient() [3/5]

unilink::wrapper::TcpClient::TcpClient ( std::shared_ptr< interface::Channel channel)
explicit

Definition at line 232 of file tcp_client.cc.

◆ ~TcpClient()

unilink::wrapper::TcpClient::~TcpClient ( )
overridedefault

◆ TcpClient() [4/5]

unilink::wrapper::TcpClient::TcpClient ( TcpClient &&  )
defaultnoexcept

◆ TcpClient() [5/5]

unilink::wrapper::TcpClient::TcpClient ( const TcpClient )
delete

Member Function Documentation

◆ auto_manage()

ChannelInterface & unilink::wrapper::TcpClient::auto_manage ( bool  manage = true)
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 261 of file tcp_client.cc.

◆ is_connected()

bool unilink::wrapper::TcpClient::is_connected ( ) const
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 242 of file tcp_client.cc.

◆ on_connect()

ChannelInterface & unilink::wrapper::TcpClient::on_connect ( ConnectionHandler  handler)
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 248 of file tcp_client.cc.

◆ on_data()

ChannelInterface & unilink::wrapper::TcpClient::on_data ( MessageHandler  handler)
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 244 of file tcp_client.cc.

◆ on_disconnect()

ChannelInterface & unilink::wrapper::TcpClient::on_disconnect ( ConnectionHandler  handler)
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 252 of file tcp_client.cc.

◆ on_error()

ChannelInterface & unilink::wrapper::TcpClient::on_error ( ErrorHandler  handler)
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 256 of file tcp_client.cc.

◆ operator=() [1/2]

TcpClient& unilink::wrapper::TcpClient::operator= ( const TcpClient )
delete

◆ operator=() [2/2]

TcpClient & unilink::wrapper::TcpClient::operator= ( TcpClient &&  )
defaultnoexcept

◆ send()

void unilink::wrapper::TcpClient::send ( std::string_view  data)
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 240 of file tcp_client.cc.

◆ send_line()

void unilink::wrapper::TcpClient::send_line ( std::string_view  line)
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 241 of file tcp_client.cc.

◆ set_connection_timeout()

TcpClient & unilink::wrapper::TcpClient::set_connection_timeout ( std::chrono::milliseconds  timeout)

Definition at line 280 of file tcp_client.cc.

◆ set_manage_external_context()

TcpClient & unilink::wrapper::TcpClient::set_manage_external_context ( bool  manage)

Definition at line 284 of file tcp_client.cc.

◆ set_max_retries()

TcpClient & unilink::wrapper::TcpClient::set_max_retries ( int  max_retries)

Definition at line 276 of file tcp_client.cc.

◆ set_retry_interval()

TcpClient & unilink::wrapper::TcpClient::set_retry_interval ( std::chrono::milliseconds  interval)

Definition at line 267 of file tcp_client.cc.

◆ start()

std::future< bool > unilink::wrapper::TcpClient::start ( )
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 238 of file tcp_client.cc.

◆ stop()

void unilink::wrapper::TcpClient::stop ( )
overridevirtual

Implements unilink::wrapper::ChannelInterface.

Definition at line 239 of file tcp_client.cc.


The documentation for this class was generated from the following files: