Skip to content

Instantly share code, notes, and snippets.

@reactormonk
Created April 30, 2010 09:34
Show Gist options
  • Select an option

  • Save reactormonk/384999 to your computer and use it in GitHub Desktop.

Select an option

Save reactormonk/384999 to your computer and use it in GitHub Desktop.
require "eventmachine"
module Echo
def post_init
puts "got new conn"
end
protected
def receive_data(data)
puts "receieved #{data}"
send_data("EHLO")
puts "sent EHLO\x00"
end
end
EM.run do
conn = EM::popen("ruby", Echo)
conn.send_data(File.read("fork.rb"))
conn.send_data("\n__END__\n")
end
require 'ruby-debug'
require "eventmachine"
module Echo
def post_init
send_data("HELLO")
end
protected
def receive_data(data)
sleep 1
puts "GTFO\x00"
end
end
EM::run do
EM.attach($stdin, Echo)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment