libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::socket::asio::client_manager< LkT > Class Template Reference

A simple TCP/IP socket wrapper using boost::asio. More...

#include <socket_client_manager.hpp>

Public Types

using socket_t = socket_wrapper< LkT >
 

Public Member Functions

template<class ConnPol >
 client_manager (std::size_t min_message_size, std::size_t max_message_size, unsigned short timeout, typename socket_t::socket_priority priority, std::size_t incoming_cpu, ConnPol const &conn_pol)
 Create a new connection to the specified TCP socket using the TCP/IP protocol. More...
 
template<class MsgT >
void write (MsgT const &message)
 Write the whole message to the socket in one go. More...
 
template<class MsgT >
void read (MsgT &dest)
 Read the whole message from the socket in one go. More...
 
template<class V , std::size_t SrcSz>
void read (V(&dest)[SrcSz])
 Read the whole message from the socket in one go. More...
 
void stop ()
 
socket_tsocket () noexcept(true)
 
std::string to_string () const noexcept(false)
 

Detailed Description

template<class LkT>
class jmmcg::socket::asio::client_manager< LkT >

A simple TCP/IP socket wrapper using boost::asio.

Definition at line 83 of file socket_client_manager.hpp.

Member Typedef Documentation

◆ socket_t

template<class LkT >
using jmmcg::socket::asio::client_manager< LkT >::socket_t = socket_wrapper<LkT>

Definition at line 102 of file socket_client_manager.hpp.

Constructor & Destructor Documentation

◆ client_manager()

template<class LkT >
template<class ConnPol >
jmmcg::socket::asio::client_manager< LkT >::client_manager ( std::size_t  min_message_size,
std::size_t  max_message_size,
unsigned short  timeout,
typename socket_t::socket_priority  priority,
std::size_t  incoming_cpu,
ConnPol const &  conn_pol 
)
inline

Create a new connection to the specified TCP socket using the TCP/IP protocol.

Parameters
min_message_sizeThe smallest size of message that shall be sent or received using the socket.
max_message_sizeThe largest size of message that shall be sent or received using the socket.
timeoutThe linger timeout in seconds.
conn_polThe connection policy that may be applied to attempt to connect to the specified endpoint.

Definition at line 77 of file socket_client_manager_impl.hpp.

Member Function Documentation

◆ read() [1/2]

template<class LkT >
template<class MsgT >
void jmmcg::socket::asio::client_manager< LkT >::read ( MsgT &  dest)
inline

Read the whole message from the socket in one go.

Parameters
destThe message will be placed into this buffer, which may be grown to accommodate the message.

Definition at line 96 of file socket_client_manager_impl.hpp.

◆ read() [2/2]

template<class LkT >
template<class V , std::size_t SrcSz>
void jmmcg::socket::asio::client_manager< LkT >::read ( V(&)  dest[SrcSz])
inline

Read the whole message from the socket in one go.

Parameters
destThe message will be placed into this stack-based buffer, which must be sufficiently large to accommodate the message read, otherwise UB will result.

Definition at line 102 of file socket_client_manager_impl.hpp.

◆ socket()

template<class LkT >
socket_t& jmmcg::socket::asio::client_manager< LkT >::socket ( )
inlinenoexcept

Definition at line 140 of file socket_client_manager.hpp.

◆ stop()

template<class LkT >
void jmmcg::socket::asio::client_manager< LkT >::stop ( )
inline

Definition at line 108 of file socket_client_manager_impl.hpp.

◆ to_string()

template<class LkT >
std::string jmmcg::socket::asio::client_manager< LkT >::to_string ( ) const
inlinenoexcept

Definition at line 114 of file socket_client_manager_impl.hpp.

◆ write()

template<class LkT >
template<class MsgT >
void jmmcg::socket::asio::client_manager< LkT >::write ( MsgT const &  message)
inline

Write the whole message to the socket in one go.

Parameters
messageThe message to write, that must be as-if a POD.

Definition at line 90 of file socket_client_manager_impl.hpp.


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