Compartilhar via


SocketOptions.SoKeepalive Field

Definition

Caution

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

When the keepalive option is set for a TCP socket and no data has been exchanged across the socket in either direction for 2 hours (NOTE: the actual value is implementation dependent), TCP automatically sends a keepalive probe to the peer.

[Android.Runtime.Register("SO_KEEPALIVE")]
[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 SoKeepalive = 8;
[<Android.Runtime.Register("SO_KEEPALIVE")>]
[<System.Obsolete("This constant will be removed in the future version. Use Java.Net.SocketOption enum directly instead of this field.", true)>]
val mutable SoKeepalive : Java.Net.SocketOption

Field Value

Value = 8
Attributes

Remarks

When the keepalive option is set for a TCP socket and no data has been exchanged across the socket in either direction for 2 hours (NOTE: the actual value is implementation dependent), TCP automatically sends a keepalive probe to the peer. This probe is a TCP segment to which the peer must respond. One of three responses is expected: 1. The peer responds with the expected ACK. The application is not notified (since everything is OK). TCP will send another probe following another 2 hours of inactivity. 2. The peer responds with an RST, which tells the local TCP that the peer host has crashed and rebooted. The socket is closed. 3. There is no response from the peer. The socket is closed.

The purpose of this option is to detect if the peer host crashes.

Valid only for TCP socket: SocketImpl

Java documentation for java.net.SocketOptions.SO_KEEPALIVE.

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