# 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 stop Break accepting loop.
provider::ResourceHandle<data::stream::IOStream> get Get incoming connection.
oatpp::async::CoroutineStarterForResult<const provider::ResourceHandle<data::stream::IOStream>&> getAsync NOT IMPLEMENTED!

# ConnectionProvider::ConnectionProvider


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(v_io_size maxToRead, v_io_size maxToWrite)

# ConnectionProvider::stop

Break accepting loop.

void stop() override

# ConnectionProvider::get

Get incoming connection.

provider::ResourceHandle<data::stream::IOStream> get() override

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