
On Fri, Apr 24, 2009 at 12:17 PM, Michael Reynolds <michael.reynolds@gmail.com> wrote:
<snip>
s = init_sockeng(); l = s->create_listener(s, 1111, NULL); </snip>
IP? How would it detect IP protocol? Is it limited to just tcp, or is udp an option? How about low level socket operations, such as buffers, reuse and timeouts?
The API is somewhat incomplete in the example, but at present there is no UDP support. I would like to add that sometime in the future. In terms of setsockopts type options, I do have stubs for functions to do those presently. They're not tied in yet.. but the plan is to support them. The idea, however, is to give defaults that will work for 90% of what we'd want to do.
<snip>
l->set_packeter(l, client_packet_delim); l->set_parser(l, client_echo_parser); l->set_onclose(l, client_disconnecty); </snip>
Perhaps these should be set in a fashion similar to setsockopt, so as to decrease the overall footprint of the system? 'Tis a lot easier for a compiler and strip to optimize a single function with a switch/case than 3+ functions.
I like this, good idea. I'll add that to my TODO list (or maybe you could do it after I release the code! :D)
I'm also interested in how you'd go about passing messages between threads without corruption and without blocking. (That's one of many things I suck at when it comes to threads.)
That's actually one thing that I've come up against. We can avoid actual blocking, but the methods of passing data between threads is still a bit fuzzy in my mind. If someone has a good general-purpose lockless queuing algorithm kicking around, I'd love to see it. -epi