I have written an application which uses IO::Socket to send data back and forth between client computers and a central server. I have been noticing that periodically, there will be some sort of a network glitch (we are sending quite a bit of data at times, so these connections can take a while), and so the connection ends up getting hung. I'd like to add some code to both the client end and the server end so it will essentially give up and close the connection after a specific amount of time. I've looked at using alarm and setting up signal handlers on both ends, but I'm wondering if this is the best method, or if anyone knows of a better solution.