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

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

#include <socket_server.hpp>

Inheritance diagram for jmmcg::socket::svr< ProcessingRules, SvrMgr >:
[legend]
Collaboration diagram for jmmcg::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 msg_processor_t = msg_processor< ProcessingRules >
 
using proc_rules_t = typename msg_processor_t::proc_rules_t
 
using thread_t = ppd::thread< ppd::platform_api, ppd::heavyweight_threading >
 

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, typename socket_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, 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, typename socket_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, 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, typename socket_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, socket_t &dest_skt, LatencyTimestamps &ts, 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, typename socket_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, 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, typename socket_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, 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, typename socket_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, LatencyTimestamps &ts, 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::application
std::sig_atomic_t signal_status () const noexcept(true)
 

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::application
 application () noexcept(true)
 
 application (application const &)=delete
 
virtual ~application ()=default
 

Detailed Description

template<class ProcessingRules, class SvrMgr>
class jmmcg::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 84 of file socket_server.hpp.

Member Typedef Documentation

◆ base_t

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

Definition at line 103 of file socket_server.hpp.

◆ exception_type

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

Definition at line 104 of file socket_server.hpp.

◆ msg_processor_t

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

Definition at line 108 of file socket_server.hpp.

◆ proc_rules_t

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

Definition at line 109 of file socket_server.hpp.

◆ server_to_client_flow_t

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

Definition at line 106 of file socket_server.hpp.

◆ socket_t

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

Definition at line 107 of file socket_server.hpp.

◆ svr_mgr_t

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

Definition at line 105 of file socket_server.hpp.

◆ thread_t

template<class ProcessingRules , class SvrMgr >
using jmmcg::socket::svr< ProcessingRules, SvrMgr >::thread_t = ppd::thread<ppd::platform_api, ppd::heavyweight_threading>

Definition at line 110 of file socket_server.hpp.

Constructor & Destructor Documentation

◆ svr() [1/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
unsigned short  timeout,
typename socket_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,
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 59 of file socket_server_impl.hpp.

◆ svr() [2/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
typename socket_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,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

Definition at line 85 of file socket_server_impl.hpp.

◆ svr() [3/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
unsigned short  timeout,
typename socket_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,
socket_t dest_skt,
LatencyTimestamps &  ts,
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 92 of file socket_server_impl.hpp.

◆ svr() [4/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps , class >
jmmcg::socket::svr< ProcessingRules, SvrMgr >::svr ( boost::asio::ip::address const &  addr,
unsigned short  port_num,
typename socket_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,
socket_t dest_skt,
LatencyTimestamps &  ts,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

Definition at line 119 of file socket_server_impl.hpp.

◆ svr() [5/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps >
jmmcg::socket::svr< ProcessingRules, SvrMgr >::svr ( ctor_args const &  args,
typename socket_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,
LatencyTimestamps &  ts,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

Definition at line 126 of file socket_server_impl.hpp.

◆ svr() [6/6]

template<class ProcessingRules , class SvrMgr >
template<class LatencyTimestamps >
jmmcg::socket::svr< ProcessingRules, SvrMgr >::svr ( ctor_args const &  args,
socket_t dest_skt,
unsigned short  timeout,
typename socket_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,
LatencyTimestamps &  ts,
server_to_client_flow_t &&  server_to_client_flow = [](auto const &) {} 
)
inlinenoexcept

Definition at line 133 of file socket_server_impl.hpp.

◆ ~svr()

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

Definition at line 138 of file socket_server_impl.hpp.

Member Function Documentation

◆ main()

template<class ProcessingRules , class SvrMgr >
int jmmcg::socket::svr< ProcessingRules, SvrMgr >::main ( int  argc,
char const *const *  argv 
)
inlinestaticnoexcept

A main() method for instantiating a stand-alone simulator.

Use this within the CRT-main().

Definition at line 149 of file socket_server_impl.hpp.

◆ stop()

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

Definition at line 143 of file socket_server_impl.hpp.

◆ to_string()

template<class ProcessingRules , class SvrMgr >
std::string jmmcg::socket::svr< ProcessingRules, SvrMgr >::to_string ( ) const
inlinenoexcept

Definition at line 214 of file socket_server_impl.hpp.


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