ROOT_Application
2.0
C++ Core modules and GUIStock
|
Define one connection of the server. More...
#include <TCPServer.h>
Public Types | |
typedef boost::shared_ptr < tcp_connection > | pointer |
Public Member Functions | |
virtual | ~tcp_connection () |
Destructor. More... | |
tcp::socket & | socket () |
Return the socket. More... | |
void | start () |
Function to be executed when a message must be send back. More... | |
tcp::socket & | GetSocket () |
Static Public Member Functions | |
static pointer | create (boost::asio::io_service &io_service) |
Static function to create a new socket. More... | |
Private Member Functions | |
tcp_connection (boost::asio::io_service &io_service) | |
Private constructor. More... | |
void | handle_write (const boost::system::error_code &error, size_t bytes_transferred) |
Function called async. More... | |
Private Attributes | |
tcp::socket | socket_ |
Store an io_service. More... | |
std::string | message_ |
Message received by the socket. More... | |
Define one connection of the server.
Only one connection at a time is created by TCPServer to listen.
and then start() is called for answering (not used now)
Use internally a boost::asio::ip::tcp::socket
"We will use shared_ptr and enable_shared_from_this because we want to keep the tcp_connection object alive as long as there is an operation that refers to it." (an asynchro. operation)
Definition at line 58 of file TCPServer.h.
typedef boost::shared_ptr<tcp_connection> tcp_connection::pointer |
Definition at line 62 of file TCPServer.h.
|
inlinevirtual |
Destructor.
Definition at line 65 of file TCPServer.h.
|
inlineprivate |
Private constructor.
Definition at line 88 of file TCPServer.h.
Referenced by create().
|
inlinestatic |
Static function to create a new socket.
Definition at line 20 of file TCPServer.cpp.
References tcp_connection().
Referenced by TCPServer::start_accept().
|
inline |
Definition at line 83 of file TCPServer.h.
References socket_.
|
private |
Function called async.
to send back data (not used)
Definition at line 44 of file TCPServer.cpp.
Referenced by start().
|
inline |
Return the socket.
Definition at line 75 of file TCPServer.h.
References socket_.
void tcp_connection::start | ( | ) |
Function to be executed when a message must be send back.
The function call async. handle_write() to answer the caller (not used)
Definition at line 29 of file TCPServer.cpp.
References handle_write(), message_, and socket_.
|
private |
Message received by the socket.
Format expected by StockManager : DJ,2014-09-22 22:08:09,17172.680000,74298798.000000 + " END" (termination)
Definition at line 103 of file TCPServer.h.
Referenced by start().
|
private |
Store an io_service.
Definition at line 99 of file TCPServer.h.
Referenced by GetSocket(), socket(), and start().