# SimpleUdpStreamProvider.hpp

This File On Github
Ask A Question

API: latest
module: oatpp-ssdp
#include "oatpp-ssdp/SimpleUdpStreamProvider.hpp"

# SimpleUdpStreamProvider

Simple implementation of provider of UDP streams.

namespace oatpp { namespace ssdp { 
  class SimpleUdpStreamProvider : public base::Countable, public network::ServerConnectionProvider {}
}}

# Methods

Return Type Name Summary
explicit SimpleUdpStreamProvider Constructor.
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 Call shutdown read and write on an underlying file descriptor.

# SimpleUdpStreamProvider::SimpleUdpStreamProvider

Constructor.

  • @param port

explicit SimpleUdpStreamProvider(v_uint16 port)

# SimpleUdpStreamProvider::close

Close accept-socket.

void close() override

# SimpleUdpStreamProvider::getConnection

Get incoming connection.

std::shared_ptr<IOStream> getConnection() override

# SimpleUdpStreamProvider::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

# SimpleUdpStreamProvider::invalidateConnection

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

  • @param connection

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