ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
tcp_connection Class Reference

Define one connection of the server. More...

#include <TCPServer.h>

Inheritance diagram for tcp_connection:
Inheritance graph
[legend]
Collaboration diagram for tcp_connection:
Collaboration graph
[legend]

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...
 

Detailed Description

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.

Member Typedef Documentation

typedef boost::shared_ptr<tcp_connection> tcp_connection::pointer

Definition at line 62 of file TCPServer.h.

Constructor & Destructor Documentation

virtual tcp_connection::~tcp_connection ( )
inlinevirtual

Destructor.

Definition at line 65 of file TCPServer.h.

tcp_connection::tcp_connection ( boost::asio::io_service &  io_service)
inlineprivate

Private constructor.

Definition at line 88 of file TCPServer.h.

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

tcp_connection::pointer tcp_connection::create ( boost::asio::io_service &  io_service)
inlinestatic

Static function to create a new socket.

Returns
a shared pointer on the new created tcp_connection

Definition at line 20 of file TCPServer.cpp.

References tcp_connection().

Referenced by TCPServer::start_accept().

Here is the call graph for this function:

Here is the caller graph for this function:

tcp::socket& tcp_connection::GetSocket ( )
inline

Definition at line 83 of file TCPServer.h.

References socket_.

void tcp_connection::handle_write ( const boost::system::error_code &  error,
size_t  bytes_transferred 
)
private

Function called async.

to send back data (not used)

Definition at line 44 of file TCPServer.cpp.

Referenced by start().

Here is the caller graph for this function:

tcp::socket& tcp_connection::socket ( )
inline

Return the socket.

Returns
_socket data member

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_.

Here is the call graph for this function:

Field Documentation

std::string tcp_connection::message_
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().

tcp::socket tcp_connection::socket_
private

Store an io_service.

Definition at line 99 of file TCPServer.h.

Referenced by GetSocket(), socket(), and start().


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