Template Class Socket

Class Documentation

template<typename Derived>
class Socket

CRTP class for platform specific socket implementation.

Public Functions

inline explicit Socket(std::string iface_name)
Socket(const Socket&) = delete
Socket &operator=(const Socket&) = delete
Socket(Socket&&) = default
Socket &operator=(Socket&&) = default
template<typename T>
inline const T &getHandle() const

Returns the native socket handle.

Returns:

native socket handle

inline void bind(const sockaddr_in &addr)

Binds the socket to an interface.

Parameters:

addr – sockaddr_in specifying the interface

inline void send(const std::vector<uint8_t> &sendbuf)

Sends data.

Parameters:

sendbuf – data to send

inline void enableBroadcast()

Enables broadcast for this socket.

inline void enableNonBlocking()

Enables non-blocking operation for this socket.

inline const std::string &getIfaceName() const

Returns the interface name.