Pick up Release IT (
http://amzn.com/0978739213) from the Pragmatic guys. While many of the examples and stories are based on Java webapps there is something in there regardless of which platform you are building atop.
Oh, and don't ever establish a blocking connection without a timeout or some other mechanism to abort it.