From: Joseph McDonald Date: 2001-03-25T13:21:53+09:00 Subject: [ruby-talk:13187] question on threads Hi, The following snippet exits immediatly after the threads try to connect to the port once. If I leave the thread.join() in there the threads do what I want: to continue to try and connect, however it blocks the rest of the program. Why are the threads exitting prematurely? #!/usr/bin/ruby require 'socket' $listen_port = 5302 class SendPipes def initialize @threads = [] @pipes = [] 5300.upto(5308) do |p| puts "starting #{p}" @threads << Thread.new { begin pipe = TCPSocket.open("localhost",p) rescue puts "caught exception: (#{p}) #{$!}" sleep 5 retry end @pipes.push(pipe) } end # @threads.each {|t| t.join } end end sp = SendPipes.new() puts sp.inspect Thanks, -joe