#!/usr/bin/ruby

require "socket"
require "thread"

class FEIControlServer
  @@flag = true

  def initialize()
    @server = TCPServer.open("192.168.4.108",11111)
    puts @server.to_s
  end

  def listener
    while @@flag
      Thread.start(@server.accept){|socket|
	begin
	  line = socket.gets.chomp
	  puts line
	  socket.puts "Accepted!"
	  

	ensure
	  socket.close
	
	end
      }
    end
  end

end

fei = FEIControlServer.new
fei.listener

