Skip to content

Instantly share code, notes, and snippets.

@dansimpson
Created July 28, 2010 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dansimpson/496238 to your computer and use it in GitHub Desktop.
Save dansimpson/496238 to your computer and use it in GitHub Desktop.
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
@dansimpson
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment