classes/CSocket.cpp
void CSocket::connectionListener()
    {
        try
        {
            boost::asio::ip::tcp::acceptor acceptor(m_ioService, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 0));
            m_hostPort = std::to_string(acceptor.local_endpoint().port());
            m_isListenThreadRunning = true;
            std::unique_ptr<SSLSocket> socket = std::make_unique<SSLSocket>(m_ioService, *m_sslContext);
            if (!socket)
            {
                throw std::runtime_error("Could not create socket.");
            }
            acceptor.accept(socket->next_layer(), m_socketError);
            if (m_socketError)
            {
                throw std::runtime_error(m_socketError.message());
            }
            m_socket = std::move(socket);
        }
        catch (const std::exception &e)
        {
            m_thrownException = std::current_exception();
        }
        m_isListenThreadRunning = false;
    }
// ===========================
// PRIVATE TYPES AND CONSTANTS
// ===========================
// ==========================
// PUBLIC TYPES AND CONSTANTS
// ==========================
// ========================
// PRIVATE STATIC VARIABLES
// ========================
// =======================
// PUBLIC STATIC VARIABLES
// =======================
// ===============
// PRIVATE METHODS
// ===============
//
// Socket listener thread method for incoming connections. At present it listens
// on a random port but sets m_hostPort to its value. The connected socket is created
// local and moved to m_socket on success.
//
PRIVATE TYPES AND CONSTANTS
PUBLIC TYPES AND CONSTANTS

PRIVATE STATIC VARIABLES

PUBLIC STATIC VARIABLES

PRIVATE METHODS

Socket listener thread method for incoming connections. At present it listens
on a random port but sets m_hostPort to its value. The connected socket is created
local and moved to m_socket on success.
PRIVATE TYPES AND CONSTANTS PUBLIC TYPES AND CONSTANTS PRIVATE STATIC VARIABLES PUBLIC STATIC VARIABLES PRIVATE METHODS Socket listener thread method for incoming connections . At present it listens on a random port but sets m_hostPort to its value . The connected socket is created local and moved to m_socket on success .
void CSocket::connectionListener()
    {
        try
        {
            boost::asio::ip::tcp::acceptor acceptor(m_ioService, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 0));
            m_hostPort = std::to_string(acceptor.local_endpoint().port());
            m_isListenThreadRunning = true;
            std::unique_ptr<SSLSocket> socket = std::make_unique<SSLSocket>(m_ioService, *m_sslContext);
            if (!socket)
            {
                throw std::runtime_error("Could not create socket.");
            }
            acceptor.accept(socket->next_layer(), m_socketError);
            if (m_socketError)
            {
                throw std::runtime_error(m_socketError.message());
            }
            m_socket = std::move(socket);
        }
        catch (const std::exception &e)
        {
            m_thrownException = std::current_exception();
        }
        m_isListenThreadRunning = false;
    }
void CSocket :: connectionListener ( ) { try { boost :: asio :: ip :: tcp :: acceptor acceptor ( m_ioService , boost :: asio :: ip :: tcp :: endpoint ( boost :: asio :: ip :: tcp :: v4 ( ) , 0 ) ) ; m_hostPort = std :: to_string ( acceptor . local_endpoint ( ) . port ( ) ) ; m_isListenThreadRunning = true ; std :: unique_ptr < SSLSocket > socket = std :: make_unique < SSLSocket > ( m_ioService , * m_sslContext ) ; if ( ! socket ) { throw std :: runtime_error ( " " ) ; } acceptor . accept ( socket -> next_layer ( ) , m_socketError ) ; if ( m_socketError ) { throw std :: runtime_error ( m_socketError . message ( ) ) ; } m_socket = std :: move ( socket ) ; } catch ( const std :: exception & e ) { m_thrownException = std :: current_exception ( ) ; } m_isListenThreadRunning = false ; }
PRIVATE TYPES AND CONSTANTS
PUBLIC TYPES AND CONSTANTS
PRIVATE TYPES AND CONSTANTS PUBLIC TYPES AND CONSTANTS