On 9/12/07, <b class="gmail_sendername">Thomas Ptacek</b> &lt;<a href="mailto:tqbf@matasano.com">tqbf@matasano.com</a>&gt; 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;">
&gt; Ok, so here&#39;s an outline of what I have. I&#39;ve been developing this in C++ as<br>&gt; a Ruby extension, but shifted to pure Ruby just for the sake of getting it<br>&gt; out there more quickly. (Eventually it will shift back to C++, since
<br>&gt; 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&#39;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&#39;ll say that this bias is not a prejudice. I&#39;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 &quot;Ruby way.&quot; I&#39;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 &quot;events&quot; that your programs can respond to. 
<br><br>EXCEPT that they are events that make sense in an SMTP context!<br><br>Things like &quot;receive_sender,&quot; &quot;receive_recipient&quot; and &quot;receive_message.&quot; EM&#39;s layered approach to protocol handling makes this possible.
<br><br>That&#39;s what makes EM different from low-level libraries like libevent.<br><br>EM is also usable without Ruby. It&#39;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&#39;s going to be a fully standalone framework, because as far as I&#39;ve been able to tell, Java has nothing directly comparable to EM.<br></div>
<br></div>