Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
TCP_Session Class Reference

implementation connection handler for TCP More...

#include <network.h>

Inheritance diagram for TCP_Session:
Inheritance graph
[legend]

Public Member Functions

virtual void close ()
 
virtual bool connect (const std::string &path, const std::string &service)
 
virtual bool connect (const boost::asio::ip::tcp::resolver::endpoint_type &ep)
 
boost::asio::ip::tcp::socket & socket ()
 getter for socket connection More...
 
 TCP_Session (boost::asio::io_service &io_service, SIG_ON_DATA &cb)
 
virtual ~TCP_Session ()
 
- Public Member Functions inherited from Any_Session
 Any_Session (SIG_ON_DATA &cb)
 every session needs a data handler More...
 
virtual ~Any_Session ()
 

Protected Types

enum  { max_length = 4096 }
 

Protected Member Functions

virtual void write (const std::string &buffer)
 write async. to TCP socket (implement abstract) More...
 
virtual void write (const std::vector< char > &buffer)
 
virtual void write (const boost::asio::mutable_buffers_1 &buffer)
 write async. to TCP socket More...
 

Protected Attributes

char data_ [max_length]
 data buffer of max. length More...
 
boost::mutex mtx_
 lock operations More...
 
boost::asio::ip::tcp::socket socket_
 TCP socket. More...
 
- Protected Attributes inherited from Any_Session
SIG_ON_DATAon_data_
 signal handler for incoming data More...
 

Private Member Functions

void handle_read (const boost::system::error_code &error, size_t bytes_transferred)
 called on incoming data –> decides if an error occured or calls handler More...
 
void handle_write (const boost::system::error_code &error)
 called if data is written (error handling) More...
 

Additional Inherited Members

- Public Types inherited from Any_Session
typedef boost::signals2::signal< void(const char *data, const size_t size, Any_Session *writer)> SIG_ON_DATA
 incoming data with "data" of size "size" and handler to write back ("writer") More...
 

Detailed Description

implementation connection handler for TCP

Definition at line 77 of file network.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
max_length 

Definition at line 196 of file network.h.

Constructor & Destructor Documentation

TCP_Session::TCP_Session ( boost::asio::io_service &  io_service,
SIG_ON_DATA cb 
)
inline

Definition at line 81 of file network.h.

virtual TCP_Session::~TCP_Session ( )
inlinevirtual

Definition at line 86 of file network.h.

Member Function Documentation

virtual void TCP_Session::close ( )
inlinevirtual

Definition at line 128 of file network.h.

virtual bool TCP_Session::connect ( const std::string &  path,
const std::string &  service 
)
inlinevirtual

Definition at line 95 of file network.h.

virtual bool TCP_Session::connect ( const boost::asio::ip::tcp::resolver::endpoint_type &  ep)
inlinevirtual

Definition at line 110 of file network.h.

void TCP_Session::handle_read ( const boost::system::error_code &  error,
size_t  bytes_transferred 
)
inlineprivate

called on incoming data –> decides if an error occured or calls handler

Definition at line 160 of file network.h.

void TCP_Session::handle_write ( const boost::system::error_code &  error)
inlineprivate

called if data is written (error handling)

Definition at line 183 of file network.h.

boost::asio::ip::tcp::socket& TCP_Session::socket ( )
inline

getter for socket connection

Definition at line 90 of file network.h.

virtual void TCP_Session::write ( const std::string &  buffer)
inlineprotectedvirtual

write async. to TCP socket (implement abstract)

Implements Any_Session.

Definition at line 136 of file network.h.

virtual void TCP_Session::write ( const std::vector< char > &  buffer)
inlineprotectedvirtual

Definition at line 142 of file network.h.

virtual void TCP_Session::write ( const boost::asio::mutable_buffers_1 &  buffer)
inlineprotectedvirtual

write async. to TCP socket

Definition at line 150 of file network.h.

Member Data Documentation

char TCP_Session::data_[max_length]
protected

data buffer of max. length

Definition at line 197 of file network.h.

boost::mutex TCP_Session::mtx_
protected

lock operations

Definition at line 198 of file network.h.

boost::asio::ip::tcp::socket TCP_Session::socket_
protected

TCP socket.

Definition at line 195 of file network.h.


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


sick_visionary_t_driver
Author(s): Joshua Hampp
autogenerated on Mon Jun 10 2019 15:09:27