class TED::Serverlet

Public Class Methods

new(ip="localhost", port=9017) click to toggle source
# File lib/serverlet.rb, line 5
def initialize(ip="localhost", port=9017)
        @hub = TCPSocket.open("46.101.76.160", 9018)
        @server = TCPServer.open(ip, port)
        @resp = nil
        @game = nil
        run
        @resp.join
end

Public Instance Methods

run() click to toggle source
# File lib/serverlet.rb, line 14
def run
        @resp = Thread.new do ## Handle all the messages coming in from the hub and act appropriatly
                loop{
                        msg = @hub.gets.chomp
                        puts msg
                }
        end
        
        Thread.new(@server.accept) do |client|
                client.puts "Connected!"
        end
end