On Oct 30, 2007, at 9:50 AM, Wurzel Cidermaker wrote:

> then stops and I presume is waiting for the "gets"
>
> To put this into some context;
>
> I have a socket client program that continously reads data from a
> server, the only way I have currently to stop it is to do a CTRL-C, I
> want/would expect a more elegant way of performing an exit on a loop.

start this before you fire up your socket stuff

reaper =
Thread.new do
   loop do
     Kernel.exit if gets == 'exit'
   end
end

if you type exit, your program will exit.  check out highline or  
search the archives if you want something more elegant - exiting a  
loop and accepting cross platform user input is a real can of worms  
made complex by the lack of getch() on *nix platforms, the  
idiosyncracies of termninal attributes, and buffering issues with pty  
vs not.

regards

a @ http://codeforpeople.com/
--
it is not enough to be compassionate.  you must act.
h.h. the 14th dalai lama