On Wed, Jun 2, 2010 at 7:55 PM, Jeremy Shaw <jeremy@n-heptane.com> wrote:

I know that some OSes provide a per socket timeout that I can set in my application code (instead of a system-wide timeout that can only be set by root). But that does not seem like a very portable solution.

SO_SENDTIMEO is your portable friend (can't remember whether it's exposed by the network package, though).