From: matz@... (Yukihiro Matsumoto) Date: 2003-05-02T11:24:35+09:00 Subject: Re: Errno::EPIPE being caused by $DEBUG Hi, In message "Errno::EPIPE being caused by $DEBUG" on 03/05/02, Daniel Berger writes: |I noticed that when I run a TCPServer in debug mode, I hit Errno::EPIPE |errors. Here are a couple quick scripts you can verify with - just |start the server in one terminal (with -d), then run the client in |another: tcpclient.rb wrote 200 packets, and read 100 times then close the socket, so that the connection lost, EPIPE raised. Then without '-d' unhandled exception terminated the socket, but with '-d' uncaught exception terminates the whole interpreter for debugging purpose. The solution should be # tcpserv.rb require "socket" t = TCPServer.new("localhost",8888) addr = t.addr addr.shift while true Thread.start(t.accept) do |s| begin while x = s.gets puts "Got: " + x s.puts(x) end rescue # catch all exceptions; do nothing ensure s.close end end end matz.