Created
April 30, 2010 09:34
-
-
Save reactormonk/384999 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 "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 |
This file contains hidden or 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 '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