Allolib  1.0
C++ Components For Interactive Multimedia
al::osc::Recv Class Reference

Socket for receiving OSC packets. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/protocol/al_OSC.hpp>

Public Member Functions

 Recv (uint16_t port, const char *address="", al_sec timeout=0)
 
bool open (uint16_t port, const char *address="", al_sec timeout=0)
 
bool isOpen ()
 
const std::string & address () const
 
uint16_t port () const
 
bool background () const
 Whether background polling is activated.
 
const char * data () const
 Get current received packet data.
 
void bufferSize (int n)
 Set size of internal buffer.
 
Recvhandler (PacketHandler &v)
 Set packet handling routine.
 
RecvappendHandler (PacketHandler &v)
 Add a packet handler to list. All handlers get all messages.
 
int recv ()
 
bool start ()
 Begin a background thread to poll the socket. More...
 
void stop ()
 Stop the background polling.
 
void parse (const char *packet, int size, const char *senderAddr)
 
void loop ()
 

Static Public Member Functions

static bool portAvailable (uint16_t port, const char *address="")
 
static std::vector< std::shared_ptr< Message > > parse (const char *packet, int size, TimeTag timeTag=1, const char *senderAddr=nullptr)
 

Protected Attributes

std::vector< PacketHandler * > mHandlers
 
std::vector< char > mBuffer
 
al::Thread mThread
 
bool mBackground
 
std::string mAddress = ""
 
uint16_t mPort = 0
 
bool mOpen {false}
 

Detailed Description

Socket for receiving OSC packets.

Supports explicit polling or implicit background thread polling

Definition at line 399 of file al_OSC.hpp.

Constructor & Destructor Documentation

◆ Recv()

al::osc::Recv::Recv ( uint16_t  port,
const char *  address = "",
al_sec  timeout = 0 
)
Parameters
[in]portPort number (valid range is 0-65535)
[in]addressIP address. If empty, will bind all network interfaces to socket.
[in]timeout< 0: block forever; = 0: no blocking; > 0 block with timeout

Member Function Documentation

◆ recv()

int al::osc::Recv::recv ( )

Check for an OSC packet and call handler returns bytes read note: use while(recv()){} to ensure queue is fully flushed.

◆ start()

bool al::osc::Recv::start ( )

Begin a background thread to poll the socket.

The socket timeout controls the polling period. Returns whether the thread was started successfully.


The documentation for this class was generated from the following file: