Share via


SocketOptions.SoTimeout Field

Definition

Caution

This constant will be removed in the future version. Use Java.Net.SocketOption enum directly instead of this field.

Set a timeout on blocking Socket operations:

[Android.Runtime.Register("SO_TIMEOUT")]
[System.Obsolete("This constant will be removed in the future version. Use Java.Net.SocketOption enum directly instead of this field.", true)]
public const Java.Net.SocketOption SoTimeout = 4102;
[<Android.Runtime.Register("SO_TIMEOUT")>]
[<System.Obsolete("This constant will be removed in the future version. Use Java.Net.SocketOption enum directly instead of this field.", true)>]
val mutable SoTimeout : Java.Net.SocketOption

Field Value

Value = 4102
Attributes

Remarks

Set a timeout on blocking Socket operations:

ServerSocket.accept();
            SocketInputStream.read();
            DatagramSocket.receive();

The option must be set prior to entering a blocking operation to take effect. If the timeout expires and the operation would continue to block, <B>java.io.InterruptedIOException</B> is raised. The Socket is not closed in this case.

Valid for all sockets: SocketImpl, DatagramSocketImpl

Java documentation for java.net.SocketOptions.SO_TIMEOUT.

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