From: Robert Klemme Date: 2005-10-19T00:12:10+09:00 Subject: Re: How do you break out of a server.accept loop? Ralph Smith wrote: > This works, but I don't know how to get out of the loop. I'm running > this on windows xp. I tried control-c, but it doesn't work. How can I > get out of a loop like this? You can for example write an event handler that throws an exception in the accepting thread. > require 'socket' > > server = TCPServer.new('127.0.0.1', 8080) > > while (session = server.accept) > session.puts session.gets > session.close > end Kind regards robert