unknown wrote:
> Oh, thanks. :) Didn't see that. :)
> 
> But, now, there are some problems. The program gets stuck in the loop
> on line 12, which I want the program to do in the background. (and it
> shouldn't get stuck) :)
> 

Please forgive me, I don't intend to be rude, but this program is not 
well thought out. You should reconsider your use of threads in the first 
place. Try an implementation with fork until you get it right. (And fork 
after you accept, not after you block on a gets from the accepted 
socket.)

I think your program gets "stuck" because you're executing your loop in 
a subclassed constructor. The new thread of control that you think 
you're getting never actually starts running. To prove it, put a print 
statement immediately after the accept, and then connect to your program 
twice, from two different shells. I predict the second client will 
appear to connect (because the TCP server picks it up in the kernel) but 
your accept call will not execute more than once.

-- 
Posted via http://www.ruby-forum.com/.