Set a maximum number of allowed connections by supplying more parameters to new : Server by gserver « Network « Ruby






Set a maximum number of allowed connections by supplying more parameters to new


require 'gserver'

class HelloServer < GServer
  def serve(io)
    io.puts("Say something to me:")
    line = io.gets
    io.puts("You said '#{line.chomp}'")
  end
end

server = HelloServer.new(1234, '127.0.0.1', 1)
server.start
server.join

 








Related examples in the same category

1.GServer
2.create multiple servers
3.manage currently running servers by using several methods GServer makes available to start, stop, and check servers