Created
July 28, 2010 20:47
-
-
Save dansimpson/496238 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "eventmachine" | |
module Echo | |
def receive_data data | |
send_data(data) | |
end | |
end | |
EM.epoll | |
EM.set_descriptor_table_size(32768) | |
EM.run do | |
EM.start_server("0.0.0.0", 12345, Echo) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run it, make sure you have ruby and rubygems installed. Then run: gem install eventmachine. Finally, save the gist to a file server.rb and run ruby server.rb.