Java MulticastSocket setNetworkInterface() Method

Last Updated : 17 Mar 2025

setNetworkInterface() is the method of MulticastSocket class. This method is used for setting outgoing multicast datagrams sent on this socket.

Syntax

Parameter

netIf - it is the interface

Throw

SocketException - this exception occurs in the underlying protocol.

Example 1

Output:

Network Inteface : name:lo (Software Loopback Interface 1)