libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr > Class Template Referencefinal

A very simple socket-based server. More...

#include <socket_server.hpp>

Inheritance diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >:
[legend]
Collaboration diagram for jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >:
[legend]

Classes

struct  ctor_args
 

Public Types

using base_t = application
 
using exception_type = crt_exception< ppd::platform_api, ppd::heavyweight_threading >
 
using svr_mgr_t = SvrMgr
 
using server_to_client_flow_t = typename svr_mgr_t::server_to_client_flow_t
 
using socket_t = typename svr_mgr_t::socket_t
 
using socket_priority = typename svr_mgr_t::socket_priority
 
using msg_processor_t = msg_processor< ProcessingRules >
 
using proc_rules_t = typename msg_processor_t::proc_rules_t
 
using thread_t = ppd::jthread
 
- Public Types inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::application
using element_type = std::sig_atomic_t
 

Public Member Functions

template<class LatencyTimestamps , class = typename std::enable_if<std::is_class<typename LatencyTimestamps::period>::value>::type>
 svr (boost::asio::ip::address const &addr, unsigned short port_num, unsigned short timeout, socket_priority priority, thread_t::thread_traits::api_params_type::processor_mask_type mask, const thread_t::thread_traits::api_params_type::priority_type cpu_priority, proc_rules_t const &proc_ops, LatencyTimestamps &ts, char const *svr_name, server_to_client_flow_t &&server_to_client_flow=[](auto const &) {}) noexcept(false)
 A simple socket-based server that listens to connections to the specified endpoint and responds to messages received in the specified manner. i.e. loops them back. More...
 
template<class LatencyTimestamps , class = typename std::enable_if<std::is_class<typename LatencyTimestamps::period>::value>::type>
 svr (boost::asio::ip::address const &addr, unsigned short port_num, socket_priority priority, thread_t::thread_traits::api_params_type::processor_mask_type mask, const thread_t::thread_traits::api_params_type::priority_type cpu_priority, proc_rules_t const &proc_ops, LatencyTimestamps &ts, char const *svr_name, server_to_client_flow_t &&server_to_client_flow=[](auto const &) {}) noexcept(false)
 
template<class LatencyTimestamps , class = typename std::enable_if<std::is_class<typename LatencyTimestamps::period>::value>::type>
 svr (boost::asio::ip::address const &addr, unsigned short port_num, unsigned short timeout, socket_priority priority, thread_t::thread_traits::api_params_type::processor_mask_type mask, const thread_t::thread_traits::api_params_type::priority_type cpu_priority, proc_rules_t const &proc_ops, socket_t &dest_skt, LatencyTimestamps &ts, char const *svr_name, server_to_client_flow_t &&server_to_client_flow=[](auto const &) {}) noexcept(false)
 A simple socket-based server that listens to connections to the specified endpoint (e.g. a client that sends FIX messages) and responds to messages received in the specified manner. i.e. forwards the messages. More...
 
template<class LatencyTimestamps , class = typename std::enable_if<std::is_class<typename LatencyTimestamps::period>::value>::type>
 svr (boost::asio::ip::address const &addr, unsigned short port_num, socket_priority priority, thread_t::thread_traits::api_params_type::processor_mask_type mask, const thread_t::thread_traits::api_params_type::priority_type cpu_priority, proc_rules_t const &proc_ops, socket_t &dest_skt, LatencyTimestamps &ts, server_to_client_flow_t &&server_to_client_flow=[](auto const &) {}) noexcept(false)
 
template<class LatencyTimestamps >
 svr (ctor_args const &args, socket_priority priority, thread_t::thread_traits::api_params_type::processor_mask_type mask, const thread_t::thread_traits::api_params_type::priority_type cpu_priority, LatencyTimestamps &ts, server_to_client_flow_t &&server_to_client_flow=[](auto const &) {}) noexcept(false)
 
template<class LatencyTimestamps >
 svr (ctor_args const &args, socket_t &dest_skt, unsigned short timeout, socket_priority priority, thread_t::thread_traits::api_params_type::processor_mask_type mask, const thread_t::thread_traits::api_params_type::priority_type cpu_priority, LatencyTimestamps &ts, char const *svr_name, server_to_client_flow_t &&server_to_client_flow=[](auto const &) {}) noexcept(false)
 
 ~svr () noexcept(true)
 
void stop () noexcept(true)
 
std::string to_string () const noexcept(false)
 
- Public Member Functions inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::application
element_type signal_status () const noexcept(true)
 Detect if a signal has been sent to the application. More...
 

Static Public Member Functions

static int main (int argc, char const *const *argv) noexcept(true)
 A main() method for instantiating a stand-alone simulator. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jmmcg::LIBJMMCG_VER_NAMESPACE::application
 application () noexcept(true)
 
 application (application const &)=delete
 
virtual ~application ()=default
 

Detailed Description

template<class ProcessingRules, class SvrMgr>
class jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >

A very simple socket-based server.

This server only handles a single client at any time. Re-connections are possible.

Definition at line 48 of file socket_server.hpp.

Member Typedef Documentation

◆ base_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::base_t = application

Definition at line 50 of file socket_server.hpp.

◆ exception_type

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::exception_type = crt_exception<ppd::platform_api, ppd::heavyweight_threading>

Definition at line 51 of file socket_server.hpp.

◆ msg_processor_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::msg_processor_t = msg_processor<ProcessingRules>

Definition at line 56 of file socket_server.hpp.

◆ proc_rules_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::proc_rules_t = typename msg_processor_t::proc_rules_t

Definition at line 57 of file socket_server.hpp.

◆ server_to_client_flow_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::server_to_client_flow_t = typename svr_mgr_t::server_to_client_flow_t

Definition at line 53 of file socket_server.hpp.

◆ socket_priority

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::socket_priority = typename svr_mgr_t::socket_priority

Definition at line 55 of file socket_server.hpp.

◆ socket_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::socket_t = typename svr_mgr_t::socket_t

Definition at line 54 of file socket_server.hpp.

◆ svr_mgr_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr_mgr_t = SvrMgr

Definition at line 52 of file socket_server.hpp.

◆ thread_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::thread_t = ppd::jthread

Definition at line 58 of file socket_server.hpp.

Constructor & Destructor Documentation

◆ svr() [1/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
unsigned short  timeout,
typename svr_mgr_t::socket_priority  priority,
thread_t::thread_traits::api_params_type::processor_mask_type  mask,
const thread_t::thread_traits::api_params_type::priority_type  cpu_priority,
proc_rules_t const &  proc_ops,
LatencyTimestamps &  ts,
char const *  svr_name,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

A simple socket-based server that listens to connections to the specified endpoint and responds to messages received in the specified manner. i.e. loops them back.

Parameters
addrThe IPv4 or IPv6 address to which the connection should be made.
port_numThe port number to which the connection should be made.
priorityThe priority at which the TCP messages should be sent, relating to QoS.
proc_opsThe responses that the server should make to messages received on the endpoint, sent back to the connected endpoint.
See also
ctor_args

Definition at line 24 of file socket_server_impl.hpp.

References jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr().

Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr().

◆ svr() [2/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
socket_priority  priority,
thread_t::thread_traits::api_params_type::processor_mask_type  mask,
const thread_t::thread_traits::api_params_type::priority_type  cpu_priority,
proc_rules_t const &  proc_ops,
LatencyTimestamps &  ts,
char const *  svr_name,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

◆ svr() [3/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
unsigned short  timeout,
socket_priority  priority,
thread_t::thread_traits::api_params_type::processor_mask_type  mask,
const thread_t::thread_traits::api_params_type::priority_type  cpu_priority,
proc_rules_t const &  proc_ops,
socket_t dest_skt,
LatencyTimestamps &  ts,
char const *  svr_name,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

A simple socket-based server that listens to connections to the specified endpoint (e.g. a client that sends FIX messages) and responds to messages received in the specified manner. i.e. forwards the messages.

Parameters
addrThe IPv4 or IPv6 address to which the connection should be made.
port_numThe port number to which the connection should be made.
priorityThe priority at which the TCP messages should be sent, relating to QoS.
proc_opsThe responses that the server should make to messages received on the endpoint.
dest_sktThe socket to which the received messages should be forwarded after suitable processing. e.g. the exchange.
See also
ctor_args

Definition at line 65 of file socket_server_impl.hpp.

References jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr().

Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr().

◆ svr() [4/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
socket_priority  priority,
thread_t::thread_traits::api_params_type::processor_mask_type  mask,
const thread_t::thread_traits::api_params_type::priority_type  cpu_priority,
proc_rules_t const &  proc_ops,
socket_t dest_skt,
LatencyTimestamps &  ts,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

◆ svr() [5/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr ( ctor_args const &  args,
socket_priority  priority,
thread_t::thread_traits::api_params_type::processor_mask_type  mask,
const thread_t::thread_traits::api_params_type::priority_type  cpu_priority,
LatencyTimestamps &  ts,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

◆ svr() [6/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::svr ( ctor_args const &  args,
socket_t dest_skt,
unsigned short  timeout,
socket_priority  priority,
thread_t::thread_traits::api_params_type::processor_mask_type  mask,
const thread_t::thread_traits::api_params_type::priority_type  cpu_priority,
LatencyTimestamps &  ts,
char const *  svr_name,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

◆ ~svr()

template<class ProcessingRules , class SvrMgr >
jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::~svr
inlinenoexcept

Member Function Documentation

◆ main()

◆ stop()

template<class ProcessingRules , class SvrMgr >
void jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::stop
inlinenoexcept

◆ to_string()

template<class ProcessingRules , class SvrMgr >
std::string jmmcg::LIBJMMCG_VER_NAMESPACE::socket::svr< ProcessingRules, SvrMgr >::to_string
inlinenoexcept

Definition at line 197 of file socket_server_impl.hpp.


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