MeVisLab Toolbox Reference
asio::TcpConnectorSession Class Reference

A TCP connector session asynchronously connecting to a TCP server. More...

#include <TcpConnectorSession.h>

Inheritance diagram for asio::TcpConnectorSession:
asio::SocketCreationSession< TcpConnectorSession >

Public Member Functions

void start ()
 
void stop ()
 
- Public Member Functions inherited from asio::SocketCreationSession< TcpConnectorSession >
SignalConnection observeConnectionEstablished (Slot &&slot)
 
SignalConnection observeErrorOccured (Slot &&slot)
 
SignalConnection observeAboutToBeDestroyed (Slot &&slot)
 
 ~SocketCreationSession ()
 

Friends

class SocketCreationSession< TcpConnectorSession >
 

Additional Inherited Members

- Static Public Member Functions inherited from asio::SocketCreationSession< TcpConnectorSession >
static std::shared_ptr< TcpConnectorSessioncreate (Arguments &&... arguments)
 
- Protected Member Functions inherited from asio::SocketCreationSession< TcpConnectorSession >
void emitConnectionEstablished (std::unique_ptr< Socket > socket)
 
void emitErrorOccured (const ErrorCode &ec)
 

Detailed Description

A TCP connector session asynchronously connecting to a TCP server.

The session implements the asio::SocketCreationSession class template and signals asio::Socket interfaces for connected sockets. Synopsis:

auto context = std::make_shared<asio::Context>();
auto session = asio::TcpConnectorSession::create(context, "127.0.0.1", 8080);
session->observeConnectionEstablished([](std::unique_ptr<asio::Socket>& socket) {
// connection has been established!
// now do something with it
});
session->start();
context->run(); // this blocks (as usual) and normally done somewhere else.
static std::shared_ptr< TcpConnectorSession > create(Arguments &&... arguments)

Definition at line 32 of file TcpConnectorSession.h.

Member Function Documentation

◆ start()

void asio::TcpConnectorSession::start ( )

◆ stop()

void asio::TcpConnectorSession::stop ( )

Friends And Related Function Documentation

◆ SocketCreationSession< TcpConnectorSession >

Definition at line 1 of file TcpConnectorSession.h.


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