public NetworkInterface getNetworkInterface ( ) throws SocketException { Integer niIndex = ( Integer ) getImpl ( ) . getOption ( SocketOptions . IP_MULTICAST_IF2 ) ; if ( niIndex == 0 ) { InetAddress [ ] addrs = new InetAddress [ 1 ] ; addrs [ 0 ] = InetAddress . anyLocalAddress ( ) ; return new NetworkInterface ( addrs [ 0 ] . getHostName ( ) , 0 , addrs ) ; } else { return NetworkInterface . getByIndex ( niIndex ) ; } }
Get the multicast network interface set .