Feature request: Wait on multiple sockets


#1

I am kind of shocked that this isn’t already in there. Juce is amazingly comprehensive in most all other areas.

I’d like to be able to do something like this:

[code]StreamingSocket s1;
DatagramSocket s2;
SocketList sockets;

sockets.addSocket(s1);
sockets.addSocket(s2);

while(true)
{
if(sockets.waitForData(200)) // wait 200ms
{
while(sockets.hasReadableSockets())
{
Socket &s = sockets.getNextReadable();
// do something
}
while(sockets.hasWritableSockets())
{
Socket &s = sockets.getNextWritable();
// do something
}
}
else
{
// timed out
}
}
[/code]

Any chance of something like this making its way into the codebase?


#2

I never seem to use sockets very much myself, so they’ve never been very high on my priority list. That’s a nice idea, though I’m too busy right now to offer to do it.