ConnectionProvider.hpp

This File On Github
Ask A Question

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

ConnectionProvider

Provider of "virtual" connections. See oatpp::network::virtual_::Interface, oatpp::network::virtual_::Socket
Extends oatpp::network::ServerConnectionProvider.

namespace oatpp { namespace network { namespace virtual_ { namespace server { 
  class ConnectionProvider : public oatpp::network::ServerConnectionProvider {}
}}}}

Methods

Return Type Name Summary
[none] ConnectionProvider Constructor.
std::shared_ptr<ConnectionProvider> createShared Create shared ConnectionProvider.
void setSocketMaxAvailableToReadWrtie Limit the available amount of bytes to read from socket and limit the available amount of bytes to write to socket.
void close Break accepting loop.
std::shared_ptr<IOStream> getConnection Get incoming connection.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync NOT IMPLEMENTED!

ConnectionProvider::ConnectionProvider

Constructor.

ConnectionProvider(const std::shared_ptr<virtual_::Interface>& interface)

ConnectionProvider::createShared

Create shared ConnectionProvider.

static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<virtual_::Interface>& interface)

ConnectionProvider::setSocketMaxAvailableToReadWrtie

Limit the available amount of bytes to read from socket and limit the available amount of bytes to write to socket.
This method is used for testing purposes only.

  • @param maxToRead - maximum available amount of bytes to read.
  • @param maxToWrite - maximum available amount of bytes to write.

void setSocketMaxAvailableToReadWrtie(data::v_io_size maxToRead, data::v_io_size maxToWrite)

ConnectionProvider::close

Break accepting loop.

void close() override

ConnectionProvider::getConnection

Get incoming connection.

std::shared_ptr<IOStream> getConnection() override

ConnectionProvider::getConnectionAsync

NOT IMPLEMENTED!
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