On 9/12/07, <b class="gmail_sendername">Thomas Ptacek</b> <<a href="mailto:tqbf@matasano.com">tqbf@matasano.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> Ok, so here's an outline of what I have. I've been developing this in C++ as<br>> a Ruby extension, but shifted to pure Ruby just for the sake of getting it<br>> out there more quickly. (Eventually it will shift back to C++, since
<br>> EventMachine is starting to be used in non-Ruby environments.)<br><br>What are the advantages of EventMachine over libevent (for C on Win32<br>and Unix) or ACE (for C++)?</blockquote><div><br><br>As I've said in the past, libevent is a first-rate piece of work, but it has problems working with MRI. But the goal of EM is completely different.
<br><br>At bottom, EM is a high-performance I/O engine, very very stable and based on years on insights from high-performance network programming. It also (I will admit) enables programmers to avoid threads, which is a personal bias of mine. (In my defense, I'll say that this bias is not a prejudice. I've been writing threaded programs on Windows since the earliest Win32 betas, 15 years ago, and on Unix since before Posix threads were a standard.)
<br><br>Above the base level, however, the goal is to provide as complete a set of tools for network programming and distributed computing as possible, congruent with the "Ruby way." I'll be happy when Ruby programmers needing to write network-aware software can reach into the EM toolkit and just pull out what they need.
<br><br>A perfect example is the subject of this thread: a complete and correct implementation of SMTP (both server and client side) that any Ruby programmer can simply drop in. The SMTP implementation (like the already-existing HTTP and other implementations) throws off "events" that your programs can respond to.
<br><br>EXCEPT that they are events that make sense in an SMTP context!<br><br>Things like "receive_sender," "receive_recipient" and "receive_message." EM's layered approach to protocol handling makes this possible.
<br><br>That's what makes EM different from low-level libraries like libevent.<br><br>EM is also usable without Ruby. It's not as easy, because not many things are as easy as Ruby, but still it wraps up all the nasty bits and the protocols.
<br><br>There is also an EM version for Java. Originally written for JRuby, it's going to be a fully standalone framework, because as far as I've been able to tell, Java has nothing directly comparable to EM.<br></div>
<br></div>