Java MulticastSocket getInterface()

Last Updated : 17 Mar 2025

getInterface() is the method of MulticastSocket class. This method is used to get address of the network interface that is used for multicast packets.

Syntax

Returns

It returns an address of the network interface.

Throw

SocketException - This exception occurs when there is error in the underlying protocol.

Example 1

Output:

Interface : /127.0.0.1