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.

Thanks