Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
tcp_echo_session Struct Reference

#include <tcp_echo_server.hpp>

Inheritance diagram for tcp_echo_session:
Collaboration diagram for tcp_echo_session:

Public Types

typedef websocketpp::lib::shared_ptr< tcp_echo_sessionptr
 

Public Member Functions

 tcp_echo_session (asio::io_service &service)
 
void start ()
 
void handle_read (const asio::error_code &ec, size_t transferred)
 
void handle_write (const asio::error_code &ec)
 

Public Attributes

asio::ip::tcp::socket m_socket
 
char m_buffer [1024]
 

Detailed Description

Definition at line 44 of file tcp_echo_server.hpp.

Member Typedef Documentation

◆ ptr

websocketpp::lib::shared_ptr<tcp_echo_session> tcp_echo_session::ptr

Definition at line 45 of file tcp_echo_server.hpp.

Constructor & Destructor Documentation

◆ tcp_echo_session()

tcp_echo_session::tcp_echo_session ( asio::io_service & service)
inline

Definition at line 47 of file tcp_echo_server.hpp.

47: m_socket(service) {}
asio::ip::tcp::socket m_socket

Member Function Documentation

◆ handle_read()

void tcp_echo_session::handle_read ( const asio::error_code & ec,
size_t transferred )
inline

Definition at line 55 of file tcp_echo_server.hpp.

55 {
56 if (!ec) {
57 asio::async_write(m_socket,
58 asio::buffer(m_buffer, transferred),
59 bind(&tcp_echo_session::handle_write, shared_from_this(), _1));
60 }
61 }
void handle_write(const asio::error_code &ec)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_write()

void tcp_echo_session::handle_write ( const asio::error_code & ec)
inline

Definition at line 63 of file tcp_echo_server.hpp.

63 {
64 if (!ec) {
65 m_socket.async_read_some(asio::buffer(m_buffer, sizeof(m_buffer)),
66 bind(&tcp_echo_session::handle_read, shared_from_this(), _1, _2));
67 }
68 }
void handle_read(const asio::error_code &ec, size_t transferred)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void tcp_echo_session::start ( )
inline

Definition at line 49 of file tcp_echo_server.hpp.

49 {
50 m_socket.async_read_some(asio::buffer(m_buffer, sizeof(m_buffer)),
51 websocketpp::lib::bind(
52 &tcp_echo_session::handle_read, shared_from_this(), _1, _2));
53 }
Here is the call graph for this function:

Member Data Documentation

◆ m_buffer

char tcp_echo_session::m_buffer[1024]

Definition at line 71 of file tcp_echo_server.hpp.

◆ m_socket

asio::ip::tcp::socket tcp_echo_session::m_socket

Definition at line 70 of file tcp_echo_server.hpp.


The documentation for this struct was generated from the following file: