Skip to content

//okhttp/okhttp3/OkHttpClient/Builder/connectTimeout

connectTimeout

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

@IgnoreJRERequirement

fun connectTimeout(duration: Duration): OkHttpClient.Builder

Sets the default connect 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 connect timeout is applied when connecting a TCP socket to the target host. The default value is 10 seconds.