I’m new to using JUCE. All I want to do is set up my own thread that waits for an external TCP connection. When that connection is established, I want my thread in JUCE to simply wait until the connection has been written to by the other end of the socket.
AFAIK, the way to do this is in the following manner:
StreamingSocket *s = new StreamingSocket();
StreamingSocket * ipSock = s->waitForNextConnection();
bytesRead = ipSock->read(buf, numBytes);
The JUCE documentation says that read() will block, but in the above example, my thread just keeps spinning on the while(true), because read() is returning -1.
If I’m doing something wrong, what’s the correct way to have my thread wait quietly until the remote end of the socket writes data to it?