171 std::optional<std::size_t> recvBufferSize = std::nullopt,
172 std::optional<std::size_t> sendBufferSize = std::nullopt,
173 std::optional<std::size_t> internalBufferSize = std::nullopt,
bool reuseAddress =
true,
174 int soRecvTimeoutMillis = -1,
int soSendTimeoutMillis = -1,
bool nonBlocking =
false,
175 bool dualStack =
true,
bool autoBind =
true);
252 void joinGroup(
const std::string& groupAddr,
const std::string& iface);
337 void leaveGroup(
const std::string& groupAddr,
const std::string& iface =
"");
849 static in6_addr
resolveIPv6(std::string_view host);
UDP datagram socket abstraction for jsocketpp.
std::string getCurrentGroup() const
Returns the last multicast group joined (for reference/debug).
Definition MulticastSocket.cpp:89
std::string _currentInterface
Interface used for multicast.
Definition MulticastSocket.hpp:928
std::string _currentGroup
Last joined multicast group address.
Definition MulticastSocket.hpp:927
static unsigned int toIfIndexFromString(const std::string &iface)
Convert a human-friendly interface identifier to an IPv6 interface index.
Definition MulticastSocket.cpp:152
int _ttl
Default TTL (Time To Live) value for multicast packets.
Definition MulticastSocket.hpp:941
bool _loopbackEnabled
Controls whether multicast packets loop back to the sending host.
Definition MulticastSocket.hpp:952
Common platform and utility includes for jsocketpp.
std::uint16_t Port
Type alias representing a TCP or UDP port number (1–65535).
Definition common.hpp:392
bool getLoopbackMode() const
Get the current multicast loopback mode cached on this socket.
Definition MulticastSocket.hpp:713
int getTimeToLive() const
Get the current default multicast TTL / hop limit cached on this socket.
Definition MulticastSocket.hpp:597
static in6_addr resolveIPv6(std::string_view host)
Resolve a host string to an IPv6 address (in6_addr).
Definition MulticastSocket.cpp:124
DatagramSocket(Port localPort=0, std::string_view localAddress="", std::optional< std::size_t > recvBufferSize=std::nullopt, std::optional< std::size_t > sendBufferSize=std::nullopt, std::optional< std::size_t > internalBufferSize=std::nullopt, bool reuseAddress=true, int soRecvTimeoutMillis=-1, int soSendTimeoutMillis=-1, bool nonBlocking=false, bool dualStack=true, bool autoBind=true, bool autoConnect=false, std::string_view remoteAddress="", Port remotePort=0, int connectTimeoutMillis=-1)
Creates a UDP socket, optionally binds to a local address, and optionally connects to a remote peer.
Definition DatagramSocket.cpp:12
static in_addr resolveIPv4(std::string_view host)
Resolve a host string to an IPv4 address (in_addr, network byte order).
Definition MulticastSocket.cpp:94
void setTimeToLive(int ttl)
Set the time-to-live (TTL) / hop limit for outgoing multicast packets.
Definition MulticastSocket.cpp:69
void joinGroup(const std::string &groupAddr, const std::string &iface)
Join a multicast group on an optional interface (string-friendly).
Definition MulticastSocket.cpp:173
MulticastSocket(Port localPort, std::string_view localAddress, std::optional< std::size_t > recvBufferSize=std::nullopt, std::optional< std::size_t > sendBufferSize=std::nullopt, std::optional< std::size_t > internalBufferSize=std::nullopt, bool reuseAddress=true, int soRecvTimeoutMillis=-1, int soSendTimeoutMillis=-1, bool nonBlocking=false, bool dualStack=true, bool autoBind=true)
Constructs a fully configurable multicast socket for receiving and sending datagrams.
Definition MulticastSocket.cpp:7
std::string getMulticastInterface() const
Get the currently selected egress interface for multicast transmissions.
Definition MulticastSocket.hpp:478
void setLoopbackMode(bool enable)
Enable or disable multicast loopback for this socket.
Definition MulticastSocket.cpp:79
void setMulticastInterface(const std::string &iface)
Select the default outgoing interface for multicast transmissions.
Definition MulticastSocket.cpp:20
void leaveGroup(const std::string &groupAddr, const std::string &iface="")
Leave a multicast group on an optional interface (string-friendly).
Definition MulticastSocket.cpp:249
A C++ socket library providing Java-style networking interfaces.
Definition BufferView.hpp:16