echoserver C++ version

Marc Lehmann schmorp at schmorp.de
Tue Mar 1 06:11:30 CET 2011


On Tue, Mar 01, 2011 at 04:44:44AM +0100, János Gulyás <gnksoft at gmail.com> wrote:
> I have tried to make a c++ version of tcp echoserver, but client callback
> does not work.

You start and instantly stop the I/O watcher in Server.cpp - it should
probably part of the client structure? In the latter case, you could also
start it in the constructor, much cleaner design.

Also:

    // Assuming that whenever a client is readable, it is also writable ?

That assumption is wrong and will either cause blocking or lost data
(blocking/non-blocking fd).

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list