Hello,

My goal is to make the fastest, most stable Ruby persistant socket
server for Flash clients as possible.  I'd like it to run on a Windows
2000 server, but if sold on Redhat Linux for this application, then
that's fine.

How many persistant sockets could this app handle in your experience
as is or with your improvements? Currently it kicks back what gets
sent to it.

The code below is my foundation, how I can make it even better for to
meet the stated goals. Your ideas are encouraged and appreciated.

Thank you,

Rick


require "socket"

listenIp = "0.0.0.0"
listenPort = 1234

socket = TCPServer.new(listenIp,listenPort)
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)

begin
  while 
    thisThread = Thread.new(session = socket.accept) {|thisSession|
      while thisSession
        # assuming a flash client
        fromClient = thisSession.gets("\0")
        thisSession.write(fromClient)
        # is sleep a good idea, and then awaken when needed?
      end
    }
  end
rescue StandardError => bang
    print "show error: " + bang
end