"David Thiel" <dthiel / nexprise.com> writes:

> users = []
> port = 4242
> server = TCPServer.new('localhost', port)
> 
> while (session = server.accept)
>     users << User.new(session)
>       users.last.thread = Thread.new(users.last) { |user|
>         user.linenum = users.length
>         user.address = user.socket.addr
>         puts "connected: #{user.to_s}"
>         until user.socket.eof
>           input = user.socket.gets
>           puts input
>           users.each {|user| user.write(input) }
>         end
>         users.delete_at(user.linenum - 1)
>         user.socket.close
>       }
> end

In this scheme, what happens if one use stops receiving the stuff you
write? Eventually, all the user threads will block on the user.write
in the loop, and hence won't get around to reading.

Could this be what you're seeing?


Dabe