# 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 stop Close accept-socket.
std::shared_ptr<data::stream::IOStream> get Get incoming connection.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<data::stream::IOStream>&> getAsync No need to implement this.
void invalidate Call shutdown read and write on an underlying file descriptor.
v_uint16 getPort Get port.

# SimpleTCPConnectionProvider::SimpleTCPConnectionProvider

Constructor.

SimpleTCPConnectionProvider(v_uint16 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_uint16 port, bool useExtendedConnections = false)

# SimpleTCPConnectionProvider::~SimpleTCPConnectionProvider

Virtual destructor.

~SimpleTCPConnectionProvider()

# SimpleTCPConnectionProvider::stop

Close accept-socket.

void stop() override

# SimpleTCPConnectionProvider::get

Get incoming connection.

std::shared_ptr<data::stream::IOStream> get() override

# SimpleTCPConnectionProvider::getAsync

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<data::stream::IOStream>&> getAsync() override

# SimpleTCPConnectionProvider::invalidate

Call shutdown read and write on an underlying file descriptor. connection MUST be an object previously obtained from THIS connection provider.

  • @param connection

void invalidate(const std::shared_ptr<data::stream::IOStream>& connection) override

# SimpleTCPConnectionProvider::getPort

Get port.

  • @return

v_uint16 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(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