Skip to content

Instantly share code, notes, and snippets.

@marekjelen
Created April 1, 2012 10:52
Show Gist options
  • Select an option

  • Save marekjelen/2274530 to your computer and use it in GitHub Desktop.

Select an option

Save marekjelen/2274530 to your computer and use it in GitHub Desktop.
Server
require 'socket'
s = TCPSocket.new ENV['OPENSHIFT_INTERNAL_IP'], 8080
while l = s.gets
puts l
end
s.close
ruby server.rb &
ruby client.rb
require 'socket'
socket = TCPServer.new(ENV['OPENSHIFT_INTERNAL_IP'], 8080)
loop do
client = socket.accept
client.puts "Hi"
client.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment