# SocketOption

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

# SocketOption

`
public


interface
SocketOption
`  
`


`

|----------------------------|
| java.net.SocketOption\<T\> |

<br />

*** ** * ** ***

A socket option associated with a socket.

In the[channels](https://developer.android.com/reference/java/nio/channels/package-summary)package, the[NetworkChannel](https://developer.android.com/reference/java/nio/channels/NetworkChannel)interface defines the[setOption](https://developer.android.com/reference/java/nio/channels/NetworkChannel#setOption(java.net.SocketOption<T>,%20T))and[getOption](https://developer.android.com/reference/java/nio/channels/NetworkChannel#getOption(java.net.SocketOption<T>))methods to set and query the channel's socket options.  
**See also:**

- [StandardSocketOptions](https://developer.android.com/reference/java/net/StandardSocketOptions)

## Summary

|                                                                                                  ### Public methods                                                                                                  ||
|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| ` abstract `[String](https://developer.android.com/reference/java/lang/String)    | ` `[name](https://developer.android.com/reference/java/net/SocketOption#name())`() ` Returns the name of the socket option.       |
| ` abstract `[Class](https://developer.android.com/reference/java/lang/Class)`<T>` | ` `[type](https://developer.android.com/reference/java/net/SocketOption#type())`() ` Returns the type of the socket option value. |

## Public methods

### name

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract String name ()
```

Returns the name of the socket option.

<br />

|                                                 Returns                                                  ||
|--------------------------------------------------------------------|--------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the name of the socket option <br /> |

### type

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Class<T> type ()
```

Returns the type of the socket option value.

<br />

|                                                      Returns                                                      ||
|-----------------------------------------------------------------------|--------------------------------------------|
| [Class](https://developer.android.com/reference/java/lang/Class)`<T>` | the type of the socket option value <br /> |