I am using curl to call a web service API. The service can unresponsive so I want to set a timeout. When I use CURLOPT_TIMEOUT things work as expected. But when I use CURLOP
I have observed, similar issue on CentOS 5.4 system running curl version 4.3.0 and it seems whenever curl is built to use 'standard system name resolver', this behaviour kicks in.
Work around is to use 'CURLOPT_NOSIGNAL' option along with 'CURLOPT_TIMEOUT_MS'; however this may have it's own consequences.
Check out details on following page: https://ravidhavlesha.wordpress.com/2012/01/08/curl-timeout-problem-and-solution/