Share via


URLConnection.ConnectTimeout Property

Definition

Returns setting for connect timeout. -or- Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection.

public virtual int ConnectTimeout { [Android.Runtime.Register("getConnectTimeout", "()I", "GetGetConnectTimeoutHandler")] get; [Android.Runtime.Register("setConnectTimeout", "(I)V", "GetSetConnectTimeout_IHandler")] set; }
[<get: Android.Runtime.Register("getConnectTimeout", "()I", "GetGetConnectTimeoutHandler")>]
[<set: Android.Runtime.Register("setConnectTimeout", "(I)V", "GetSetConnectTimeout_IHandler")>]
member this.ConnectTimeout : int with get, set

Property Value

an int that indicates the connect timeout value in milliseconds

Attributes

Exceptions

if timeoutMillis < 0.

Remarks

Property getter documentation:

Returns setting for connect timeout.

0 return implies that the option is disabled (i.e., timeout of infinity).

Added in 1.5.

Java documentation for java.net.URLConnection.getConnectTimeout().

Property setter documentation:

Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection. If the timeout expires before the connection can be established, a java.net.SocketTimeoutException is raised. A timeout of zero is interpreted as an infinite timeout.

Some non-standard implementation of this method may ignore the specified timeout. To see the connect timeout set, please call getConnectTimeout().

<strong>Warning</strong>: If the hostname resolves to multiple IP addresses, Android's default implementation of HttpURLConnection will try each in RFC 3484 order. If connecting to each of these addresses fails, multiple timeouts will elapse before the connect attempt throws an exception. Host names that support both IPv6 and IPv4 always have at least 2 IP addresses.

Added in 1.5.

Java documentation for java.net.URLConnection.setConnectTimeout(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to