Skip to content

//okhttp/okhttp3/OkHttpClient/Builder/callTimeout

callTimeout

[jvm]\ fun callTimeout(timeout: Long, unit: TimeUnit): OkHttpClient.Builder

@IgnoreJRERequirement

fun callTimeout(duration: Duration): OkHttpClient.Builder

Sets the default timeout for complete calls. A value of 0 means no timeout, otherwise values must be between 1 and Integer.MAX_VALUE when converted to milliseconds.

The call timeout spans the entire call: resolving DNS, connecting, writing the request body, server processing, and reading the response body. If the call requires redirects or retries all must complete within one timeout period.

The default value is 0 which imposes no timeout.