From: Jonathan Gillette Date: 2002-06-22T05:56:26+09:00 Subject: Re: detecting a socket dropping in multi-threaded app Firestone, Mark - Technical Support (mark.firestone@gossgraphic.co.uk) wrote: > If I set abort on exception = true, then the @socket.write command before > the interator generates an exception I can trap, just before the whole > program abends. Yep. You could wrap all socket read/writes in the begin..rescue block. > I tried testing for nils after the @socket.eachbyte, but that doesn't work > either. I am not sure where to go from here.. ideas? I don't understand > your ping idea, as the client is a telnet session. Maybe I am being > thick... Yeah, I forgot your client would be a simple telnet session. In the same vein as a ping, you could have a thread watching for inactive threads and shutting them down. So you could keep a timestamp on the last time a thread read a byte and shutdown the thread if too much time elapsed. In my Ruby socket servers, I tend to stay away from trying to catch all the possible exceptions and just keep a single thread that monitors the others. It's just less of a headache. I guess I hate having to worry about missing an exception. -- Jonathan Gillette iNetZ Media