adding timeout for web requests and handling related socket errors