Example unix socket echo server
coolaj86 at gmail.com
Mon Nov 1 15:02:43 CET 2010
I'll keep playing with mine to see if I can get it right, but please show me
yours as soon as you have it up.
Sent from my Google Android
On Nov 1, 2010 7:35 AM, "common at gmx.ch" <common at gmx.ch> wrote:
> AJ ONeal wrote:
>> I would really appreciate some feedback from those who use libev as to
>> how to make it a better example. I think that the first thing I'll need
>> to do is to add a custom struct to get rid of the globals.
> The code is misleading, you are doing it wrong.
> The polling the nonblocking server socket is okay.
> Accepting clients should be done in a loop to empty the listen queue.
> The clients socket is not nonblocking.
> Receiving data from the client is blocking and in a loop in the accept
> callback of the servers socket, therefore this server can only handle a
> single connection.
> The accepted connection never sends something back, therefore this
> example misses nonblocking writes and is not an "echo" server.
> Furthermore, there is no real difference if you use ip or unix domain
> sockets, but there is more love to connect to ip services, so I'd
> provide examples which deal with ip instead of unix domain sockets.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libev