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.

  • @param port - port to listen for incoming connections.
  • @param port

SimpleTCPConnectionProvider(v_word16 port)

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)

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