Example unix socket echo server

Rasmus Andersson rasmus at notion.se
Sat Oct 30 01:06:12 CEST 2010


Here's a datagram/UDP echo server previously posted on this list,
which might help you:
http://lists.schmorp.de/pipermail/libev/2010q1/001010.html

On Sat, Oct 30, 2010 at 00:25, AJ ONeal <coolaj86 at gmail.com> wrote:
> I spent a few hours reading through the documentation. I didn't understand
> all of it, but it was enlightening.
>
> I've done a fair amount of googling and I've found some reference
> implementations using libev.
>
> However, I'm now trying to build my own bare-bones socket-based echo server
> and I'm not quite sure how to go about it, nor have I found anything n the
> middle between between the too simple stdin example and the over-my-head
> tcpdns example.
>
>
>
> Am I correct that this is what the flow will be like?
>
> Server waits for data in non-blocking fashion
> Event fires when a client connects
> Server receives data in non-blocking fashion
> Server chews bubble gum or something for a while, maybe accepts another
> connection...
> Event fires when data is received
> Server echos data
>
> Here's the code that I have so far:
> http://github.com/coolaj86/libev-examples/blob/master/unix-echo.c
>
> What I don't understand right now is why the socket is ready for reading
> when nothing is connecting to it to read from.
>
> AJ ONeal
>
> _______________________________________________
> libev mailing list
> libev at lists.schmorp.de
> http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
>



-- 
Rasmus Andersson



More information about the libev mailing list