Created
October 3, 2011 18:05
-
-
Save JakubOboza/1259790 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
#!/usr/bin/env ruby | |
['rubygems', 'eventmachine'].map{|x| require x} | |
module SelfServer; def receive_data(data); send_data(IO.readlines __FILE__); end; end; | |
EventMachine::run do | |
host = ARGV[1] || '0.0.0.0' | |
port = ARGV[2] || 8080 | |
EventMachine::start_server host, port, SelfServer | |
puts "If you don't like defaults try chaging host or port" | |
puts "Open 2 terminal and try telnet #{host} #{port} and press enter" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment