Java MulticastSocket setInterface() Method

21 Mar 2025 | 1 min read

setInterface(InetAddress inf) is the method of MulticastSocket class. This method is used to set address of the network interface that is used for multicast packets.

Syntax

Parameter

inf - It is the InetAddress

Throw

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

Example 1

Output:

Interface : /127.0.0.1