SimpleTCPConnectionProvider.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/network/server/SimpleTCPConnectionProvider.hpp"

SimpleTCPConnectionProvider

Simple provider of TCP connections.

namespace oatpp { namespace network { namespace server { 
  class SimpleTCPConnectionProvider : public base::Countable, public ServerConnectionProvider {}
}}}

Methods

Return Type Name Summary
[none] SimpleTCPConnectionProvider Constructor.
std::shared_ptr<SimpleTCPConnectionProvider> createShared Create shared SimpleTCPConnectionProvider.
[none] ~SimpleTCPConnectionProvider Virtual destructor.
void close Close accept-socket.
std::shared_ptr<IOStream> getConnection Get incoming connection.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync No need to implement this.
void invalidateConnection Does nothing.
v_word16 getPort Get port.

SimpleTCPConnectionProvider::SimpleTCPConnectionProvider

Constructor.

SimpleTCPConnectionProvider(v_word16 port, bool useExtendedConnections = false)

SimpleTCPConnectionProvider::createShared

Create shared SimpleTCPConnectionProvider.

  • @param port - port to listen for incoming connections.
  • @param port
  • @return - std::shared_ptr to SimpleTCPConnectionProvider.

static std::shared_ptr<SimpleTCPConnectionProvider> createShared(v_word16 port, bool useExtendedConnections = false)

SimpleTCPConnectionProvider::~SimpleTCPConnectionProvider

Virtual destructor.

~SimpleTCPConnectionProvider()

SimpleTCPConnectionProvider::close

Close accept-socket.

void close() override

SimpleTCPConnectionProvider::getConnection

Get incoming connection.

std::shared_ptr<IOStream> getConnection() override

SimpleTCPConnectionProvider::getConnectionAsync

No need to implement this.
For Asynchronous IO in oatpp it is considered to be a good practice to accept connections in a seperate thread with the blocking accept() and then process connections in Asynchronous manner with non-blocking read/write.
It may be implemented later

oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override

SimpleTCPConnectionProvider::invalidateConnection

Does nothing.

  • @param connection

void invalidateConnection(const std::shared_ptr<IOStream>& connection) override

SimpleTCPConnectionProvider::getPort

Get port.

  • @return

v_word16 getPort()

SimpleTCPConnectionProvider::ExtendedConnection

Connection with extra data - ex.: peer address.

namespace oatpp { namespace network { namespace server { 
  class SimpleTCPConnectionProvider : public base::Countable, public ServerConnectionProvider {
    class ExtendedConnection : public oatpp::network::Connection {}
  };
}}}

Methods

Return Type Name Summary
[none] ExtendedConnection Constructor.
oatpp::data::stream::Context& getOutputStreamContext Get output stream context.
oatpp::data::stream::Context& getInputStreamContext Get input stream context.

SimpleTCPConnectionProvider::ExtendedConnection::ExtendedConnection

Constructor.

ExtendedConnection(data::v_io_handle handle, data::stream::Context::Properties&& properties)

SimpleTCPConnectionProvider::ExtendedConnection::getOutputStreamContext

Get output stream context.

oatpp::data::stream::Context& getOutputStreamContext() override

SimpleTCPConnectionProvider::ExtendedConnection::getInputStreamContext

Get input stream context.

oatpp::data::stream::Context& getInputStreamContext() override