I'm having an issue with threading and TCP servers on Win32.  I've
boiled down the issue to the following code:

-----

require 'socket'

t = Thread.new do
  serv = TCPServer.new '', 344
  sock = serv.accept
  sock.puts "ok"
  sock.close
  serv.close
end

puts "OK, enter text: "
puts gets

-----

So with a server listening in the background, the program should
accept one new request and respond with "ok".  In the meantime, it
should be waiting for the user to enter text on STDIN.

If this program is running in a UNIX environment, I can telnet to port
344 and I'll be greeted with "ok" and the program will continue to
wait for user input.  However, when I run the same code on Windows,
the connection on port 344 opens (i.e. there is no connection refused
error), but no text is received.  If I enter a word on the server's
STDIN and hit enter, the server quits and the connection is severed,
but the "ok" still doesn't get to the client.

I am quite possibly missing something obvious here, but I'm not sure
what it is.  Any help would be appreciated.

-- 
Bill Atkins