Blog Archive for July 26, 2013

HttpClient Timeout

July 26, 2013

By default, HttpClient doesn't have a socket timeout. I've encountered a situation where the server didn't respond at all, and the HttpClient just sat there until it was restarted.

Version 3

To add a timeout to Http Client version 3:

HttpClient lClient = new HttpClient();
int lTimeoutMilliseconds = 10 …