Java Socket isBound() method

The isBound () method of Java Socket class returns a Boolean value representing the binding state of the socket. This method would continue to return 'true' for a closed socket, if it was bound before being closed.

Syntax

Parameter

NA

Return

The isBound () method would return a Boolean value 'true' if the socket was successfully bound to an address.

Example 1

Test it Now

Output:

The Socket is bounded: true

Example 2

Test it Now

Output:

The Socket is bounded:  false

Example 3

Test it Now

Output:

The Socket is bounded:  true




Latest Courses