From: Noah Date: 2004-02-21T11:04:51+09:00 Subject: Re: TCPserver client disconnect "Joel VanderWerf" wrote in message news:4036ACF4.9000007@path.berkeley.edu... > Noah wrote: > > ruby newbie question... > > > > How can I detect when a client disconnects from a TCPserver? > > I'm streaming data to the client in a while loop (Shoutcast-style mp3 > > stream), but I'm not sure what condition to test to see if the client drops > > out. > > Does sample/svr.rb (in the ruby distribution) help? > Not really, because in that example, the server is checking for the client eof, right? (Correct me if I'm wrong. I just started with Ruby a few days ago.) In my application, the client makes one initial request, and then simply receives. The server is the only one sending data. It's like a HTTP request. Imagine a client does a GET on a very large file. The server begins to send the data, but the client drops out half-way through. How can the server detect this and cancel the transfer?