ListeningConnectionManager

To use this thing:

void handler(Socket s) { do something... } auto manager = new ListeningConnectionManager("127.0.0.1", 80, &handler); manager.listen();

I suggest you use BufferedInputRange(connection) to handle the input. As a packet comes in, you will get control. You can just continue; though to fetch more.

More...
class ListeningConnectionManager {
Semaphore semaphore;
Socket[256] queue;
shared(ubyte) nextIndexFront;
ubyte nextIndexBack;
shared(int) queueLength;
bool tcp;
void delegate() cleanup;
Socket listener;
void function(Socket) handler;
bool running;
}

Detailed Description

FIXME: should I offer an event based async thing like netman did too? Yeah, probably.

Meta