SocketImpl.GetOption Method

Definition

Overloads

GetOption(Int32)

Fetch the value of an option.

GetOption(ISocketOption)

Called to get a socket option.

GetOption(Int32)

Fetch the value of an option.

[Android.Runtime.Register("getOption", "(I)Ljava/lang/Object;", "GetGetOption_IHandler")]
public abstract Java.Lang.Object? GetOption (int optID);
[<Android.Runtime.Register("getOption", "(I)Ljava/lang/Object;", "GetGetOption_IHandler")>]
abstract member GetOption : int -> Java.Lang.Object

Parameters

optID
Int32

an int identifying the option to fetch

Returns

the value of the option

Implements

Attributes

Remarks

Fetch the value of an option. Binary options will return java.lang.Boolean.TRUE if enabled, java.lang.Boolean.FALSE if disabled, e.g.: <BR>

SocketImpl s;
            ...
            Boolean noDelay = (Boolean)(s.getOption(TCP_NODELAY));
            if (noDelay.booleanValue()) {
                // true if TCP_NODELAY is enabled...
            ...
            }

For options that take a particular type as a parameter, getOption(int) will return the parameter's value, else it will return java.lang.Boolean.FALSE:

Object o = s.getOption(SO_LINGER);
            if (o instanceof Integer) {
                System.out.print("Linger time is " + ((Integer)o).intValue());
            } else {
              // the true type of o is java.lang.Boolean.FALSE;
            }

Java documentation for java.net.SocketOptions.getOption(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

GetOption(ISocketOption)

Called to get a socket option.

[Android.Runtime.Register("getOption", "(Ljava/net/SocketOption;)Ljava/lang/Object;", "GetGetOption_Ljava_net_SocketOption_Handler", ApiSince=33)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
protected virtual Java.Lang.Object? GetOption (Java.Net.ISocketOption? name);
[<Android.Runtime.Register("getOption", "(Ljava/net/SocketOption;)Ljava/lang/Object;", "GetGetOption_Ljava_net_SocketOption_Handler", ApiSince=33)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
abstract member GetOption : Java.Net.ISocketOption -> Java.Lang.Object
override this.GetOption : Java.Net.ISocketOption -> Java.Lang.Object

Parameters

name
ISocketOption

The socket option

Returns

the value of the named option

Attributes

Remarks

Called to get a socket option.

Added in 9.

Java documentation for java.net.SocketImpl.getOption(java.net.SocketOption<T>).

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