but you are joining the first thread (a)... that means thread b won't
start before thread a terminates.
try this one:

require 'socket'
require 'resolv-replace'

count = 0

b = Thread.new do
begin
Thread.pass
s = TCPSocket.new("192.168.0.5", 6667)
rescue Exception
puts "cannot connect"
end
end

loop {
count += 1
puts count
sleep(0.1)
}

assuming that 192.168.0.5 is not reachable the output in linux will be:
1
2
3
[...]
not connected
[...]
under windows:

1
not connected (after ~20secs)
2
3
4
[...]

christoph