I was trying the code out but what is this "User" class??
Obviously it's not a system class, right?

If possible, pls provide the code...

TIA.


ts wrote:
> 
> >>>>> "D" == David Thiel <dthiel / nexprise.com> writes:
> 
> D> Is this a problem with gets or threading?
> 
>  No, with your source :-)
> 
> D> while (session = server.accept)
> D>     users << User.new(session)
> D>       users.last.thread = Thread.new(users.last) { |user|
>                                                        ^^^^
> D>         user.linenum = users.length
> D>         user.address = user.socket.addr
> D>         puts "connected: #{user.to_s}"
> D>         until user.socket.eof
>                  ^^^^
> D>           input = user.socket.gets
> D>           puts input
> D>           users.each {|user| user.write(input) }
>                           ^^^^
> 
>  You re-use the same variable and erase its content, write it
> 
>             users.each {|new_user| new_user.write(input) }
> 
> D>         end
> D>         users.delete_at(user.linenum - 1)
> D>         user.socket.close
> D>       }
> D> end
> 
> Guy Decoux

-- 
Wai-Sun "Squidster" Chia
Unix/Web Developer/RHCE
Professional Services