
-----------------------------------
wtd
Thu Aug 05, 2004 5:48 pm

Fairly simple multi-user client-server setup in Ruby
-----------------------------------
hehe, I think this belongs here :) 

Heh... got me to thinking about how you'd write a fairly simple multi-user client-server setup in Ruby.  It's not perfect by any means, but it kicks Turing all over the place on number of lines.  ;)

chat_server.rb

require "socket"
require "thread"

PORT = (ARGV.shift or 5535).to_i

ADMIN = ARGV.shift or "Chris"
PASSWORD = ARGV.shift or "God"

chat_server = TCPServer.new("localhost", PORT)

chat_clients = []

loop do
	Thread.new(chat_server.accept) do |chat_client|
		chat_clients 