Created
October 8, 2015 22:38
-
-
Save duckinator/2e958c62ae33457a156c to your computer and use it in GitHub Desktop.
Relies on the `from` and `net-socket` gems.
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 'from' | |
from('net/socket').include(:TCP) | |
async = !!ARGV.delete('--async') | |
socket = TCP::Server.new('0.0.0.0', 9001) | |
socket.each_request(async) do |conn| | |
conn.puts conn.read | |
end | |
socket.wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment