Class UdpSocket

Class Documentation

class UdpSocket

UDP socket class.

This class contains everything needed for creating a UDP socket, for listeners and broadcasters, reading and writing, etc.

Public Functions

UdpSocket()

basic class constructor

UdpSocket(uint16_t port_in, std::string group_in)

useful constructor for a server

UdpSocket(const UdpSocket &obj)

copy constructor

~UdpSocket()

class destructor

inline void setport(uint16_t port_in)
inline int getport()

use to set port when default constructor used

inline bool is_running()

use to get port

inline void setgroup(std::string group_in)

is the UDP service running?

inline std::string getgroup()

use to set group when default constructor used

int Create()

use to get group

create a UDP multi-cast socket

int Send(std::string message)

transmit the message to the UDP socket

int Close()

close the UDP socket connection

int Listener()

creates a UDP listener, returns a file descriptor

ssize_t Receive(std::string &message)

receive a UDP message from the Listener fd