Created
October 31, 2008 21:19
-
-
Save bmizerany/21422 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 'rubygems' | |
require 'eventmachine' | |
module TapsClient | |
def post_init | |
send_data("hey!") | |
end | |
def receive_data(data) | |
p [Time.now, data] | |
STDOUT.flush | |
end | |
end | |
EventMachine.run do | |
EM.connect 'localhost', 5678, TapsClient | |
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 'rubygems' | |
require 'eventmachine' | |
module TapsServer | |
def recieve_data(data) | |
send_data(data) | |
end | |
end | |
EM.run do | |
EM.start_server('localhost', 5678, TapsServer) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment