Now wrapping all network operations inside a ResourceT, to ensure
proper release of sockets when we're done.