Javatpoint Logo
Javatpoint Logo

Java ServerSocket getLocalSocketAddress() Method

The getLocalSocketAddress() method of ServerSocket class returns the address of the endpoint to which this socket is bound to, otherwise returns null if it is not bound yet. If the socket was bound before being closed, then this method will continue to return the address of the endpoint after the socket is closed.

Syntax

Returns:

A SocketAddress representing the local endpoint of this socket, or null if it is not bound yet.

Since:

1.4

Example 1

ServerApplication:

ClientApplication:

Output:

Java ServerSocket getLocalSocketAddress() Method
Java ServerSocket getLocalSocketAddress() Method

Example 2

Java ServerSocket getLocalSocketAddress() 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