Skip to content

//okhttp/okhttp3/OkHttpClient/Builder/readTimeout

readTimeout

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

@IgnoreJRERequirement

fun readTimeout(duration: Duration): OkHttpClient.Builder

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

The read timeout is applied to both the TCP socket and for individual read IO operations including on Source of the Response. The default value is 10 seconds.

See also

jvm

java.net.Socket
okio.Source