private static int joinMcGroupsOnAllNetworkInterfaces ( MulticastSocket pSocket , InetSocketAddress pSocketAddress , LogHandler pLogHandler ) throws IOException { // V6: ffx8::/16 Enumeration < NetworkInterface > nifs = NetworkInterface . getNetworkInterfaces ( ) ; int interfacesJoined = 0 ; while ( nifs . hasMoreElements ( ) ) { NetworkInterface n = nifs . nextElement ( ) ; if ( NetworkUtil . isMulticastSupported ( n ) ) { try { pSocket . joinGroup ( pSocketAddress , n ) ; interfacesJoined ++ ; } catch ( IOException exp ) { pLogHandler . info ( "Cannot join multicast group on NIF " + n . getDisplayName ( ) + ": " + exp . getMessage ( ) ) ; } } } return interfacesJoined ; }
We are using all interfaces available and try to join them