mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
parent
cc99affa41
commit
b2dd844489
4 changed files with 802 additions and 802 deletions
|
|
@ -149,12 +149,12 @@ public:
|
|||
const String& getTypeName() const throw() { return typeName; }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the names of all the available output channels on this device.
|
||||
/** Returns the names of all the available output channels on this device.
|
||||
To find out which of these are currently in use, call getActiveOutputChannels().
|
||||
*/
|
||||
virtual const StringArray getOutputChannelNames() = 0;
|
||||
|
||||
/** Returns the names of all the available input channels on this device.
|
||||
/** Returns the names of all the available input channels on this device.
|
||||
To find out which of these are currently in use, call getActiveInputChannels().
|
||||
*/
|
||||
virtual const StringArray getInputChannelNames() = 0;
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ static bool bindSocketToPort (const int handle, const int port) throw()
|
|||
return bind (handle, (struct sockaddr*) &servTmpAddr, sizeof (struct sockaddr_in)) >= 0;
|
||||
}
|
||||
|
||||
static int readSocket (const int handle,
|
||||
void* const destBuffer, const int maxBytesToRead,
|
||||
static int readSocket (const int handle,
|
||||
void* const destBuffer, const int maxBytesToRead,
|
||||
bool volatile& connected) throw()
|
||||
{
|
||||
int bytesRead = 0;
|
||||
|
|
@ -148,7 +148,7 @@ static int readSocket (const int handle,
|
|||
return bytesRead;
|
||||
}
|
||||
|
||||
static int waitForReadiness (const int handle, const bool forReading,
|
||||
static int waitForReadiness (const int handle, const bool forReading,
|
||||
const int timeoutMsecs) throw()
|
||||
{
|
||||
struct timeval timeout;
|
||||
|
|
@ -209,7 +209,7 @@ static bool setSocketBlockingState (const int handle, const bool shouldBlock) th
|
|||
return false;
|
||||
|
||||
if (shouldBlock)
|
||||
socketFlags &= ~O_NONBLOCK;
|
||||
socketFlags &= ~O_NONBLOCK;
|
||||
else
|
||||
socketFlags |= O_NONBLOCK;
|
||||
|
||||
|
|
@ -265,14 +265,14 @@ static bool connectSocket (int volatile& handle,
|
|||
#if JUCE_WIN32
|
||||
if (result == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
#else
|
||||
if (result == EINPROGRESS)
|
||||
if (result == EINPROGRESS)
|
||||
#endif
|
||||
{
|
||||
if (waitForReadiness (handle, false, timeOutMillisecs) != 1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setSocketBlockingState (handle, true);
|
||||
resetSocketOptions (handle, false);
|
||||
|
||||
|
|
@ -291,8 +291,8 @@ StreamingSocket::StreamingSocket()
|
|||
#endif
|
||||
}
|
||||
|
||||
StreamingSocket::StreamingSocket (const String& hostName_,
|
||||
const int portNumber_,
|
||||
StreamingSocket::StreamingSocket (const String& hostName_,
|
||||
const int portNumber_,
|
||||
const int handle_)
|
||||
: hostName (hostName_),
|
||||
portNumber (portNumber_),
|
||||
|
|
@ -339,7 +339,7 @@ int StreamingSocket::write (const void* sourceBuffer, const int numBytesToWrite)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
int StreamingSocket::waitUntilReady (const bool readyForReading,
|
||||
int StreamingSocket::waitUntilReady (const bool readyForReading,
|
||||
const int timeoutMsecs) const
|
||||
{
|
||||
return connected ? waitForReadiness (handle, readyForReading, timeoutMsecs)
|
||||
|
|
@ -488,7 +488,7 @@ DatagramSocket::DatagramSocket (const int localPortNumber)
|
|||
bindToPort (localPortNumber);
|
||||
}
|
||||
|
||||
DatagramSocket::DatagramSocket (const String& hostName_, const int portNumber_,
|
||||
DatagramSocket::DatagramSocket (const String& hostName_, const int portNumber_,
|
||||
const int handle_, const int localPortNumber)
|
||||
: hostName (hostName_),
|
||||
portNumber (portNumber_),
|
||||
|
|
@ -542,7 +542,7 @@ bool DatagramSocket::connect (const String& remoteHostName,
|
|||
hostName = remoteHostName;
|
||||
portNumber = remotePortNumber;
|
||||
|
||||
connected = connectSocket (handle, true, &serverAddress,
|
||||
connected = connectSocket (handle, true, &serverAddress,
|
||||
remoteHostName, remotePortNumber,
|
||||
timeOutMillisecs);
|
||||
|
||||
|
|
@ -571,7 +571,7 @@ DatagramSocket* DatagramSocket::waitForNextConnection() const
|
|||
|
||||
if (recvfrom (handle, buf, 0, 0, &address, &len) > 0)
|
||||
{
|
||||
return new DatagramSocket (inet_ntoa (((struct sockaddr_in*) &address)->sin_addr),
|
||||
return new DatagramSocket (inet_ntoa (((struct sockaddr_in*) &address)->sin_addr),
|
||||
ntohs (((struct sockaddr_in*) &address)->sin_port),
|
||||
-1, -1);
|
||||
}
|
||||
|
|
@ -581,7 +581,7 @@ DatagramSocket* DatagramSocket::waitForNextConnection() const
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
int DatagramSocket::waitUntilReady (const bool readyForReading,
|
||||
int DatagramSocket::waitUntilReady (const bool readyForReading,
|
||||
const int timeoutMsecs) const
|
||||
{
|
||||
return connected ? waitForReadiness (handle, readyForReading, timeoutMsecs)
|
||||
|
|
@ -597,11 +597,11 @@ int DatagramSocket::read (void* destBuffer, const int maxBytesToRead)
|
|||
int DatagramSocket::write (const void* sourceBuffer, const int numBytesToWrite)
|
||||
{
|
||||
// You need to call connect() first to set the server address..
|
||||
jassert (serverAddress != 0 && connected);
|
||||
jassert (serverAddress != 0 && connected);
|
||||
|
||||
return connected ? sendto (handle, (const char*) sourceBuffer,
|
||||
numBytesToWrite, 0,
|
||||
(const struct sockaddr*) serverAddress,
|
||||
return connected ? sendto (handle, (const char*) sourceBuffer,
|
||||
numBytesToWrite, 0,
|
||||
(const struct sockaddr*) serverAddress,
|
||||
sizeof (struct sockaddr_in))
|
||||
: -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public:
|
|||
//==============================================================================
|
||||
/** Binds the socket to the specified local port.
|
||||
|
||||
@returns true on success; false may indicate that another socket is already bound
|
||||
@returns true on success; false may indicate that another socket is already bound
|
||||
on the same port
|
||||
*/
|
||||
bool bindToPort (const int localPortNumber);
|
||||
|
|
@ -106,15 +106,15 @@ public:
|
|||
If the timeout is < 0, it will wait forever, or else will give up after
|
||||
the specified time.
|
||||
|
||||
If the socket is ready on return, this returns 1. If it times-out before
|
||||
If the socket is ready on return, this returns 1. If it times-out before
|
||||
the socket becomes ready, it returns 0. If an error occurs, it returns -1.
|
||||
*/
|
||||
int waitUntilReady (const bool readyForReading,
|
||||
int waitUntilReady (const bool readyForReading,
|
||||
const int timeoutMsecs) const;
|
||||
|
||||
/** Reads bytes from the socket (blocking).
|
||||
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
for reading before calling it (see the waitUntilReady() method).
|
||||
|
||||
@returns the number of bytes read, or -1 if there was an error.
|
||||
|
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
/** Writes bytes to the socket from a buffer.
|
||||
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
for writing before calling it (see the waitUntilReady() method).
|
||||
|
||||
@returns the number of bytes written, or -1 if there was an error.
|
||||
|
|
@ -188,8 +188,8 @@ public:
|
|||
The localPortNumber is the port on which to bind this socket. If this value is 0,
|
||||
the port number is assigned by the operating system.
|
||||
|
||||
To use the socket for sending, call the connect() method. This will not immediately
|
||||
make a connection, but will save the destination you've provided. After this, you can
|
||||
To use the socket for sending, call the connect() method. This will not immediately
|
||||
make a connection, but will save the destination you've provided. After this, you can
|
||||
call read() or write().
|
||||
|
||||
To wait for other sockets to connect to this one, call waitForNextConnection().
|
||||
|
|
@ -202,7 +202,7 @@ public:
|
|||
//==============================================================================
|
||||
/** Binds the socket to the specified local port.
|
||||
|
||||
@returns true on success; false may indicate that another socket is already bound
|
||||
@returns true on success; false may indicate that another socket is already bound
|
||||
on the same port
|
||||
*/
|
||||
bool bindToPort (const int localPortNumber);
|
||||
|
|
@ -243,15 +243,15 @@ public:
|
|||
If the timeout is < 0, it will wait forever, or else will give up after
|
||||
the specified time.
|
||||
|
||||
If the socket is ready on return, this returns 1. If it times-out before
|
||||
If the socket is ready on return, this returns 1. If it times-out before
|
||||
the socket becomes ready, it returns 0. If an error occurs, it returns -1.
|
||||
*/
|
||||
int waitUntilReady (const bool readyForReading,
|
||||
int waitUntilReady (const bool readyForReading,
|
||||
const int timeoutMsecs) const;
|
||||
|
||||
/** Reads bytes from the socket (blocking).
|
||||
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
for reading before calling it (see the waitUntilReady() method).
|
||||
|
||||
@returns the number of bytes read, or -1 if there was an error.
|
||||
|
|
@ -260,7 +260,7 @@ public:
|
|||
|
||||
/** Writes bytes to the socket from a buffer.
|
||||
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
Note that this method will block unless you have checked the socket is ready
|
||||
for writing before calling it (see the waitUntilReady() method).
|
||||
|
||||
@returns the number of bytes written, or -1 if there was an error.
|
||||
|
|
@ -271,7 +271,7 @@ public:
|
|||
/** This waits for incoming data to be sent, and returns a socket that can be used
|
||||
to read it.
|
||||
|
||||
The object that gets returned is owned by the caller, and can't be used for
|
||||
The object that gets returned is owned by the caller, and can't be used for
|
||||
sending, but can be used to read the data.
|
||||
*/
|
||||
DatagramSocket* waitForNextConnection() const;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue