# UdpStream.hpp
This File On Github
Ask A Question
API: latest
module: oatpp-ssdp
#include "oatpp-ssdp/UdpStream.hpp"
# UdpStream
Class to read/write UDP packets - packet-by-packet.
namespace oatpp { namespace ssdp {
class UdpStream : public base::Countable, public data::stream::IOStream {}
}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | UdpStream | Constructor. Takes an UDP server handle and directly recvfrom it via populate. |
v_io_size | write | A single call to write will produce a single UDP-packet. |
v_io_size | read | Read a UDP-packet payload data. |
void | setOutputStreamIOMode | Set OutputStream I/O mode. |
oatpp::data::stream::IOMode | getOutputStreamIOMode | Set OutputStream I/O mode. |
oatpp::data::stream::Context& | getOutputStreamContext | Get output stream context. |
void | setInputStreamIOMode | Set InputStream I/O mode. |
oatpp::data::stream::IOMode | getInputStreamIOMode | Get InputStream I/O mode. |
oatpp::data::stream::Context& | getInputStreamContext | Get input stream context. |
v_io_handle | getHandle | Get an underlying IO handle. |
# UdpStream::UdpStream
Constructor. Takes an UDP server handle and directly recvfrom
it via populate.
- @param - UDP server handle
UdpStream(v_io_handle handle)
# UdpStream::write
A single call to write will produce a single UDP-packet.
Implementation of oatpp::data::stream::IOStream::write.
- @param buff - buffer containing data to write.
- @param count - bytes count you want to write.
- @param action - async specific action. If action is NOT oatpp::async::Action::TYPE_NONE, then caller MUST return this action on coroutine iteration.
- @return - actual amount of bytes written. See oatpp::v_io_size.
v_io_size write(const void *buff, v_buff_size count, async::Action& action) override
# UdpStream::read
Read a UDP-packet payload data. Multiple calls to read()
will read data from the same UDP-packet. Once data of a single UDP-packet is exhausted, the oatpp::IOError::ZERO is returned to designate the end of a packet.
Implementation of oatpp::data::stream::IOStream::read.
- @param buff - buffer to read data to.
- @param count - buffer size.
- @param action - async specific action. If action is NOT oatpp::async::Action::TYPE_NONE, then caller MUST return this action on coroutine iteration.
- @return - actual amount of bytes read. See oatpp::v_io_size.
v_io_size read(void *buff, v_buff_size count, async::Action& action) override
# UdpStream::setOutputStreamIOMode
Set OutputStream I/O mode.
- @param ioMode
void setOutputStreamIOMode(oatpp::data::stream::IOMode ioMode) override
# UdpStream::getOutputStreamIOMode
Set OutputStream I/O mode.
- @return
oatpp::data::stream::IOMode getOutputStreamIOMode() override
# UdpStream::getOutputStreamContext
Get output stream context.
- @return - oatpp::data::stream::Context.
oatpp::data::stream::Context& getOutputStreamContext() override
# UdpStream::setInputStreamIOMode
Set InputStream I/O mode.
- @param ioMode
void setInputStreamIOMode(oatpp::data::stream::IOMode ioMode) override
# UdpStream::getInputStreamIOMode
Get InputStream I/O mode.
- @return
oatpp::data::stream::IOMode getInputStreamIOMode() override
# UdpStream::getInputStreamContext
Get input stream context.
- @return - oatpp::data::stream::Context.
oatpp::data::stream::Context& getInputStreamContext() override
# UdpStream::getHandle
Get an underlying IO handle.
- @return
v_io_handle getHandle()