February 14, 2012
How would you chat with a server? This is my naive attempt:

class Client {
   Socket socket;

  Token fetch() {
    ubyte[1024] buffer;  // if more space is needed...
     return decode(buffer);

  void send(Token tkn) {
   ubyte[] buffer = encode(tkn);

It can send and fetch data (encoded tokens) to/from server. But frequently I see network clients using a connection pool or an event loop. I descarted event loops because they looks hard to implement (and libev docs don't let me anywhere).

Do you can guide me on this trouble?

Pedro Lacerda

Top | Discussion index | About this forum | D home