1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-13 00:04:19 +00:00

Add multicast support to juce_Socket

This commit is contained in:
hogliux 2015-04-29 12:21:54 +01:00
parent 581158e443
commit 67cc7f3fed
2 changed files with 707 additions and 622 deletions

File diff suppressed because it is too large Load diff

View file

@ -65,6 +65,18 @@ public:
*/
bool bindToPort (int localPortNumber);
/** Binds the socket to the specified local port and local address.
If localAddress is not an empty string then the socket will be bound to localAddress
as well. This is useful if you would like to bind your socket to a specific network
adapter. Note that localAddress must be an IP address assigned to one of your
network address otherwise this function will fail.
@returns true on success; false may indicate that another socket is already bound
on the same port
@see bindToPort(int localPortNumber), IPAddress::findAllAddresses
*/
bool bindToPort (int localPortNumber, const String& localAddress);
/** Returns the local port number to which this socket is currently bound.
This is useful if you need to know to which port the OS has actually bound your
@ -218,6 +230,18 @@ public:
*/
bool bindToPort (int localPortNumber);
/** Binds the socket to the specified local port and local address.
If localAddress is not an empty string then the socket will be bound to localAddress
as well. This is useful if you would like to bind your socket to a specific network
adapter. Note that localAddress must be an IP address assigned to one of your
network address otherwise this function will fail.
@returns true on success; false may indicate that another socket is already bound
on the same port
@see bindToPort(int localPortNumber), IPAddress::findAllAddresses
*/
bool bindToPort (int localPortNumber, const String& localAddress);
/** Returns the local port number to which this socket is currently bound.
This is useful if you need to know to which port the OS has actually bound your
@ -282,11 +306,24 @@ public:
int write (const String& remoteHostname, int remotePortNumber,
const void* sourceBuffer, int numBytesToWrite);
//==============================================================================
/** Join a multicast group
@returns true if it succeeds.
*/
bool joinMulticast (const String& multicastIPAddress);
/** Leave a multicast group
@returns true if it succeeds.
*/
bool leaveMulticast (const String& multicastIPAddress);
private:
//==============================================================================
int handle;
bool isBound;
String lastServerHost;
String lastBindAddress, lastServerHost;
int lastServerPort;
void* lastServerAddress;
mutable CriticalSection readLock;