65 bool bindToPort (
int localPortNumber);
77 bool bindToPort (
int localPortNumber,
const String& localAddress);
85 int getBoundPort()
const noexcept;
95 bool connect (
const String& remoteHostname,
97 int timeOutMillisecs = 3000);
109 int getPort() const noexcept {
return portNumber; }
112 bool isLocal()
const noexcept;
129 int waitUntilReady (
bool readyForReading,
int timeoutMsecs);
141 int read (
void* destBuffer,
int maxBytesToRead,
142 bool blockUntilSpecifiedAmountHasArrived);
151 int write (
const void* sourceBuffer,
int numBytesToWrite);
167 bool createListener (
int portNumber,
const String& localHostName =
String());
183 std::atomic<int> portNumber { 0 }, handle { -1 };
184 std::atomic<bool> connected {
false };
185 bool isListener =
false;
233 bool bindToPort (
int localPortNumber);
245 bool bindToPort (
int localPortNumber,
const String& localAddress);
253 int getBoundPort()
const noexcept;
270 int waitUntilReady (
bool readyForReading,
int timeoutMsecs);
282 int read (
void* destBuffer,
int maxBytesToRead,
283 bool blockUntilSpecifiedAmountHasArrived);
296 int read (
void* destBuffer,
int maxBytesToRead,
297 bool blockUntilSpecifiedAmountHasArrived,
298 String& senderIPAddress,
int& senderPortNumber);
307 int write (
const String& remoteHostname,
int remotePortNumber,
308 const void* sourceBuffer,
int numBytesToWrite);
328 bool joinMulticast (
const String& multicastIPAddress);
333 bool leaveMulticast (
const String& multicastIPAddress);
338 bool setMulticastLoopbackEnabled (
bool enableLoopback);
349 bool setEnablePortReuse (
bool enabled);
353 std::atomic<int> handle { -1 };
354 bool isBound =
false;
355 String lastBindAddress, lastServerHost;
356 int lastServerPort = -1;
357 void* lastServerAddress =
nullptr;
int getRawSocketHandle() const noexcept
Returns the OS's socket handle that's currently open.
bool isConnected() const noexcept
True if the socket is currently connected.
A wrapper for a datagram (UDP) socket.
#define JUCE_API
This macro is added to all JUCE public class declarations.
int getPort() const noexcept
Returns the port number that's currently open.
const String & getHostName() const noexcept
Returns the name of the currently connected host.
A wrapper for a streaming (TCP) socket.
int getRawSocketHandle() const noexcept
Returns the OS's socket handle that's currently open.