Java MulticastSocket getTTL() method

getTTL() is the method of MulticastSocket class. This method is used to get the default time-to-live for the multicast packets which are sent out on the socket.

Syntax

Returns

It returns the default time-to-live value.

Throw

IOException - This exception occurs while getting the default time-to-live value.

NOTE : this method is Deprecated, instead of this method getTimeToLive method is used as it returns an int instead of a byte.

Example 1

Test it Now

Output:

TTL : 25

Example 2

Test it Now

Output:

TTL : 30




Latest Courses