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

# SimpleUdpStreamProvider::SimpleUdpStreamProvider


  • @param port

explicit SimpleUdpStreamProvider(v_uint16 port)

# SimpleUdpStreamProvider::stop

Close accept-socket.

void stop() override

# SimpleUdpStreamProvider::get

Get incoming connection.

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

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

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