SocketOption
Stay organized with collections
Save and categorize content based on your preferences.
Public Method Summary
abstract
String
|
name()
Returns the name of the socket option.
|
abstract
Class<T>
|
type()
Returns the type of the socket option value.
|
Public Methods
public
abstract
String
name
()
Returns the name of the socket option.
Returns
- the name of the socket option
public
abstract
Class<T>
type
()
Returns the type of the socket option value.
Returns
- the type of the socket option value
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eSocketOption\u003c/code\u003e is an interface used for associating options with a socket.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eNetworkChannel\u003c/code\u003e interface provides methods (\u003ccode\u003esetOption\u003c/code\u003e and \u003ccode\u003egetOption\u003c/code\u003e) for managing socket options.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSocketOption\u003c/code\u003e includes methods to retrieve the name (\u003ccode\u003ename()\u003c/code\u003e) and the value type (\u003ccode\u003etype()\u003c/code\u003e) of the option.\u003c/p\u003e\n"],["\u003cp\u003eRefer to \u003ccode\u003eStandardSocketOptions\u003c/code\u003e for a list of commonly used socket options.\u003c/p\u003e\n"]]],[],null,["# SocketOption\n\npublic interface **SocketOption** \nA socket option associated with a socket.\n\nIn the [channels](../../../reference/java/nio/channels/package-summary.html) package, the [NetworkChannel](../../../reference/java/nio/channels/NetworkChannel.html) interface defines the [setOption](../../../reference/java/nio/channels/NetworkChannel.html#setOption(java.net.SocketOption\u003cT\u003e,%20T))\nand [getOption](../../../reference/java/nio/channels/NetworkChannel.html#getOption(java.net.SocketOption\u003cT\u003e))\nmethods to set and query the channel's socket options. \n\n##### See Also\n\n- [StandardSocketOptions](../../../reference/java/net/StandardSocketOptions.html) \n\n### Public Method Summary\n\n|----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|\n| abstract [String](../../../reference/java/lang/String.html) | [name](../../../reference/java/net/SocketOption.html#name())() Returns the name of the socket option. |\n| abstract [Class](../../../reference/java/lang/Class.html)\\\u003cT\\\u003e | [type](../../../reference/java/net/SocketOption.html#type())() Returns the type of the socket option value. |\n\nPublic Methods\n--------------\n\n#### public abstract [String](../../../reference/java/lang/String.html)\n**name**\n()\n\nReturns the name of the socket option. \n\n##### Returns\n\n- the name of the socket option \n\n#### public abstract [Class](../../../reference/java/lang/Class.html)\\\u003cT\\\u003e\n**type**\n()\n\nReturns the type of the socket option value. \n\n##### Returns\n\n- the type of the socket option value"]]