![]() |
Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Network sender/receiver. More...
#include <transceiver.h>
Public Member Functions | |
Transceiver (packet::PacketPool &packet_pool, core::BufferPool< uint8_t > &buffer_pool, core::IAllocator &allocator) | |
Initialize. More... | |
virtual | ~Transceiver () |
Destroy. Stop all receivers and senders. More... | |
bool | valid () const |
Check if transceiver was successfully constructed. More... | |
size_t | num_ports () const |
Get number of receiver and sender ports. More... | |
bool | add_udp_receiver (packet::Address &bind_address, packet::IWriter &writer) |
Add UDP datagram receiver port. More... | |
packet::IWriter * | add_udp_sender (packet::Address &bind_address) |
Add UDP datagram sender port. More... | |
void | remove_port (packet::Address bind_address) |
Remove sender or receiver port. Wait until port will be removed. More... | |
Network sender/receiver.
Definition at line 36 of file transceiver.h.
roc::netio::Transceiver::Transceiver | ( | packet::PacketPool & | packet_pool, |
core::BufferPool< uint8_t > & | buffer_pool, | ||
core::IAllocator & | allocator | ||
) |
Initialize.
|
virtual |
Destroy. Stop all receivers and senders.
bool roc::netio::Transceiver::add_udp_receiver | ( | packet::Address & | bind_address, |
packet::IWriter & | writer | ||
) |
Add UDP datagram receiver port.
Creates a new UDP receiver and bind it to bind_address
. The receiver will pass packets to writer
. Writer will be called from the network thread. It should not block.
If IP is zero, INADDR_ANY is used, i.e. the socket is bound to all network interfaces. If port is zero, a random free port is selected and written back to bind_address
.
packet::IWriter* roc::netio::Transceiver::add_udp_sender | ( | packet::Address & | bind_address | ) |
Add UDP datagram sender port.
Creates a new UDP sender, bind to bind_address
, and returns a writer that may be used to send packets from this address. Writer may be called from any thread. It will not block the caller.
If IP is zero, INADDR_ANY is used, i.e. the socket is bound to all network interfaces. If port is zero, a random free port is selected and written back to bind_address
.
size_t roc::netio::Transceiver::num_ports | ( | ) | const |
Get number of receiver and sender ports.
void roc::netio::Transceiver::remove_port | ( | packet::Address | bind_address | ) |
Remove sender or receiver port. Wait until port will be removed.
bool roc::netio::Transceiver::valid | ( | ) | const |
Check if transceiver was successfully constructed.