This function sets the
timeout
value (in seconds).If the
timeout
value is less than zero, it is ignored and a success status is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | intent(out) | :: | curl_ptr |
Pointer to the |
||
integer(kind=int64), | intent(in) | :: | timeout |
|
Status code
indicating whether the operation was successful.
function set_timeout(curl_ptr, timeout) result(status)
!!> This function sets the `timeout` value **(in seconds)**.
!!>
!!> If the `timeout` value is **less than zero**, it is ignored and a success status is returned.
type(c_ptr), intent(out) :: curl_ptr
!! Pointer to the `curl` handle.
integer(kind=int64), intent(in) :: timeout
!! `Timeout` seconds for request.
integer :: status
!! `Status code` indicating whether the operation was successful.
if(timeout < 0) then
status = 0
else
! setting the maximum time allowed for the connection to established.(in seconds)
status = curl_easy_setopt(curl_ptr, CURLOPT_CONNECTTIMEOUT, timeout)
! setting maximum time allowed for transfer operation.(in seconds)
status = curl_easy_setopt(curl_ptr, CURLOPT_TIMEOUT, timeout)
end if
end function set_timeout