mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
added broadcast and binding options
This commit is contained in:
parent
669ac2cc8f
commit
4f98d0ec2f
2 changed files with 25 additions and 1 deletions
|
|
@ -68,6 +68,21 @@
|
|||
#ifndef JUCE_ALLOW_SPECIAL_CHARS_IN_ADDRESS
|
||||
#define JUCE_ALLOW_SPECIAL_CHARS_IN_ADDRESS 0
|
||||
#endif
|
||||
|
||||
/** Config: JUCE_ENABLE_BROADCAST_BY_DEFAULT
|
||||
Automatically enables broadcast on bound port in OSCReceiver
|
||||
*/
|
||||
#ifndef JUCE_ENABLE_BROADCAST_BY_DEFAULT
|
||||
#define JUCE_ENABLE_BROADCAST_BY_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/** Config: JUCE_EXCLUSIVE_BINDING_BY_DEFAULT
|
||||
If enabled, this will make the binding of this port exclusive, so no other process can bind it.
|
||||
*/
|
||||
#ifndef JUCE_EXCLUSIVE_BINDING_BY_DEFAULT
|
||||
#define JUCE_EXCLUSIVE_BINDING_BY_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/** Config: JUCE_IP_AND_PORT_DETECTION
|
||||
If enabled, this will add remoteIP and remotePort variables to osc packets, corresponding to the sender's ip and port when receiving messages.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -354,7 +354,16 @@ struct OSCReceiver::Pimpl : private Thread,
|
|||
if (! disconnect())
|
||||
return false;
|
||||
|
||||
socket.setOwned (new DatagramSocket (false));
|
||||
#if JUCE_ENABLE_BROADCAST_BY_DEFAULT
|
||||
DatagramSocket* datagram = new DatagramSocket(true);
|
||||
#else
|
||||
DatagramSocket* datagram = new DatagramSocket(false);
|
||||
#endif
|
||||
socket.setOwned(datagram);
|
||||
|
||||
#if JUCE_EXCLUSIVE_BINDING_BY_DEFAULT
|
||||
socket->setEnablePortReuse(false);
|
||||
#endif
|
||||
|
||||
if (! socket->bindToPort (portNumber))
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue