libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::LIBJMMCG_VER_NAMESPACE::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 >
 
using socket_priority = typename socket_t::socket_priority
 

Public Member Functions

template<class ConnPol >
 client_manager (std::size_t min_message_size, std::size_t max_message_size, unsigned short timeout, 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::LIBJMMCG_VER_NAMESPACE::socket::asio::client_manager< LkT >

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

Definition at line 30 of file socket_client_manager.hpp.

Member Typedef Documentation

◆ socket_priority

◆ socket_t

Definition at line 32 of file socket_client_manager.hpp.

Constructor & Destructor Documentation

◆ client_manager()

template<class LkT >
template<class ConnPol >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::asio::client_manager< LkT >::client_manager ( std::size_t  min_message_size,
std::size_t  max_message_size,
unsigned short  timeout,
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 25 of file socket_client_manager_impl.hpp.

Member Function Documentation

◆ read() [1/2]

template<class LkT >
template<class MsgT >
void jmmcg::LIBJMMCG_VER_NAMESPACE::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 44 of file socket_client_manager_impl.hpp.

◆ read() [2/2]

template<class LkT >
template<class V , std::size_t SrcSz>
void jmmcg::LIBJMMCG_VER_NAMESPACE::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 50 of file socket_client_manager_impl.hpp.

◆ socket()

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

Definition at line 71 of file socket_client_manager.hpp.

◆ stop()

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

Definition at line 56 of file socket_client_manager_impl.hpp.

◆ to_string()

template<class LkT >
std::string jmmcg::LIBJMMCG_VER_NAMESPACE::socket::asio::client_manager< LkT >::to_string
inlinenoexcept

Definition at line 62 of file socket_client_manager_impl.hpp.

◆ write()

template<class LkT >
template<class MsgT >
void jmmcg::LIBJMMCG_VER_NAMESPACE::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 38 of file socket_client_manager_impl.hpp.


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