From 000636346d092b136d0d5f93d307b8de6068d965 Mon Sep 17 00:00:00 2001 From: LK-Coda <53861727+LK-Coda@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:24:33 +0100 Subject: [PATCH 1/2] Update juce_Socket.h --- modules/juce_core/network/juce_Socket.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/juce_core/network/juce_Socket.h b/modules/juce_core/network/juce_Socket.h index 6d877fad338a..2b82aa74fe83 100644 --- a/modules/juce_core/network/juce_Socket.h +++ b/modules/juce_core/network/juce_Socket.h @@ -328,12 +328,16 @@ class JUCE_API DatagramSocket final @returns true if it succeeds */ bool joinMulticast (const String& multicastIPAddress); + + bool joinMulticast (const String& multicastIPAddress, const String& localIPAddress); /** Leave a multicast group. @returns true if it succeeds */ bool leaveMulticast (const String& multicastIPAddress); + + bool leaveMulticast (const String& multicastIPAddress, const String& localIPAddress); /** Enables or disables multicast loopback. From ab1bf015a27963f134ccf9888e5d550809248ffa Mon Sep 17 00:00:00 2001 From: LK-Coda <53861727+LK-Coda@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:26:58 +0100 Subject: [PATCH 2/2] Update juce_Socket.cpp --- modules/juce_core/network/juce_Socket.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/juce_core/network/juce_Socket.cpp b/modules/juce_core/network/juce_Socket.cpp index c020720b2a0f..dfd6f09f18f4 100644 --- a/modules/juce_core/network/juce_Socket.cpp +++ b/modules/juce_core/network/juce_Socket.cpp @@ -755,6 +755,14 @@ bool DatagramSocket::joinMulticast (const String& multicastIPAddress) return SocketHelpers::multicast (handle, multicastIPAddress, lastBindAddress, true); } + +bool DatagramSocket::joinMulticast (const String& multicastIPAddress, const String& localIPAddress) +{ + if (handle < 0 || ! isBound) + return false; + + return SocketHelpers::multicast (handle, multicastIPAddress, localIPAddress, true); +} bool DatagramSocket::leaveMulticast (const String& multicastIPAddress) { @@ -763,6 +771,14 @@ bool DatagramSocket::leaveMulticast (const String& multicastIPAddress) return SocketHelpers::multicast (handle, multicastIPAddress, lastBindAddress, false); } + +bool DatagramSocket::leaveMulticast (const String& multicastIPAddress, const String& localIPAddress) +{ + if (handle < 0 || ! isBound) + return false; + + return SocketHelpers::multicast (handle, multicastIPAddress, localIPAddress, false); +} bool DatagramSocket::setMulticastLoopbackEnabled (bool enable) {