Receive UDP packets from IP address and port. The receiver is multicast aware. More...
#include <udpreceiver.h>
Public Member Functions | |
UDPReceiver (boost::function< void(void *, std::size_t)> function, boost::asio::io_service &io_service, const boost::asio::ip::address &address, short port) | |
~UDPReceiver () |
Receive UDP packets from IP address and port. The receiver is multicast aware.
If the address provided belongs to the IP multicast range, the multicast group is automatically joined, else it is handled as unicast.
SCS::UDPReceiver::UDPReceiver | ( | boost::function< void(void *, std::size_t)> | function, |
boost::asio::io_service & | io_service, | ||
const boost::asio::ip::address & | address, | ||
short | port | ||
) |
Open a socket and listen asynchronously to incoming data.
function | function to parse incoming data, takes a raw pointer to data and size in bytes |
io_service | a boost::asio::io_service to handle the asynchronous requests |
address | ip address struct |
port | port from which data is received |
SCS::UDPReceiver::~UDPReceiver | ( | ) |
Stop receiving data and close connection.