MeVisLab Toolbox Reference
asio::TlsConnectorSession Class Reference

A TCP connector session with TLS support asynchronously connecting to a TCP server. More...

#include <TlsConnectorSession.h>

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

Public Member Functions

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

Friends

class SocketCreationSession< TlsConnectorSession >

Additional Inherited Members

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

Detailed Description

A TCP connector session with TLS support asynchronously connecting to a TCP server.

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

auto context = std::make_shared<asio::Context>();
auto tls_context = std::make_shared<asio::TlsContext>(asio::TlsContext::tlsv12_client);
// configure TLS context
tls_context->set_default_verify_paths();
auto session = asio::TlsConnectorSession::create(context, tls_context, "127.0.0.1", 443);
session->observeConnectionEstablished([](std::unique_ptr<asio::Socket>& socket) {
// connection with successful TLS handshake has been established!
// now do something with it. Encryption is done automatically.
});
session->start();
context->run(); // this blocks (as usual) and normally done somewhere else.
static std::shared_ptr< TlsConnectorSession > create(Arguments &&... arguments)

Definition at line 36 of file TlsConnectorSession.h.

Member Function Documentation

◆ start()

void asio::TlsConnectorSession::start ( )

◆ stop()

void asio::TlsConnectorSession::stop ( )

◆ SocketCreationSession< TlsConnectorSession >

friend class SocketCreationSession< TlsConnectorSession >
friend

Definition at line 36 of file TlsConnectorSession.h.

References ASYNCHRONOUSIO_EXPORT.


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