Hello, World
Well, no, it won't be "Hello, World," not strictly speaking anyway. But here's a really small (and useful) program written with EventMachine.
It's an echo server. It creates a TCP listener on port 10000 that accepts connections, and sends back all data received on each connection.
require 'rubygems'
require 'eventmachine'
module Echo
def receive_data data
send_data data
end
end
EM.run {
EM.start_server "0.0.0.0", 10000, Echo
}
