Example unix socket echo server

AJ ONeal coolaj86 at gmail.com
Tue Nov 2 05:44:58 CET 2010


I believe that I've done this Unix Socket Echo Server "the right way" now:

http://github.com/coolaj86/libev-examples/blob/master/unix-echo.c

The question that I have is if it's true to say that a unix socket is
writable whenever it is readable?

When I tried listening for when it was writable, it seemed to fire the event
over and over again.
I didn't think that was particularly helpful.

Or is it that when I want to send data I should
    start the watcher for writes
    send the data
    stop the watcher
?


Now who wants to change the Unix Socket stuff out for TCP?
I may eventually get around to it, but that's not what I need right now,
interestingly enough.

I'll try my hand at a client now.

AJ ONeal


On Mon, Nov 1, 2010 at 10:03 AM, AJ ONeal <coolaj86 at gmail.com> wrote:

> Thank you for the link, but this is beyond my current scope of
> understanding.
> I was hoping for a simple example.
>
> I'm trying to start out small and learn my way up.
>
> Things like this and the dns example are a bit too heavy for me to able to
> bite off in a chunk, digest, and take the next bite.
>
> If I also had a call graph, that would help a lot with an example like
> this, but on it's own there are just too many layers to jump back and forth
> between to understand what's going on.
>
> Do you happen to have a doxygen/dot (or other) call graph for this code?
>
> AJ ONeal
>
>
>
> On Mon, Nov 1, 2010 at 9:03 AM, common at gmx.ch <common at gmx.ch> wrote:
>
>> AJ ONeal wrote:
>>
>>> Thanks.
>>>
>>> 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.
>>>
>>
>> It's part of a larger project, it does
>>  * tcp
>>  * udp
>>  * tls (via nonblocking openssl)
>>  * IPV4 & IPv6
>>  * unix domain sockets
>>  * client & server
>>  * rate limiting (in & out) per connection
>>  * resolve domains inline & nonblocking, so you can just
>> connection_connect("example.com",80);
>>
>> and provides timeouts for almost everything you want to be able to
>> control, listen, idle, sustain, accept, handshake for ssl
>>
>> http://src.carnivore.it/dionaea/tree/src/connection.c
>>
>>
>> Markus
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20101101/afc21787/attachment.html>


More information about the libev mailing list