/usr/share/doc/ruby-eventmachine/examples/guides/getting_started/01_eventmachine_echo_server.rb is in ruby-eventmachine 1.0.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #!/usr/bin/env ruby
require 'rubygems' # or use Bundler.setup
require 'eventmachine'
class EchoServer < EM::Connection
def receive_data(data)
send_data(data)
end
end
EventMachine.run do
# hit Control + C to stop
Signal.trap("INT") { EventMachine.stop }
Signal.trap("TERM") { EventMachine.stop }
EventMachine.start_server("0.0.0.0", 10000, EchoServer)
end
|