Javatpoint Logo
Javatpoint Logo

Java ServerSocket getChannel() Method

The getChannel() method of the ServerSocket class is used to return the unique ServerSocketChannel object associated with this socket if any. A server socket will have a channel if, and only if, the channel itself was created via the ServerSocketChannel.open method.

Syntax

Returns:

The server-socket channel associated with this socket, or null if this socket was not created for a channel.

Since:

1.4

Example 1

Output:

Java ServerSocket getChannel() Method

Example 2

ServerApplication:

Client Application

Output:

Java ServerSocket getChannel() Method
Java ServerSocket getChannel() Method
Next TopicJava ServerSocket





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA