Home / Function/ NetworkInterface() — netty Function Reference

NetworkInterface() — netty Function Reference

Architecture documentation for the NetworkInterface() function in DatagramMulticastTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9e6b8f94_acf2_dfd0_61f9_40caaa752ff5["NetworkInterface()"]
  7bb89696_7318_cc89_132f_ac17760ac2ee["DatagramMulticastTest"]
  9e6b8f94_acf2_dfd0_61f9_40caaa752ff5 -->|defined in| 7bb89696_7318_cc89_132f_ac17760ac2ee
  e15de1c5_0b2f_2ddf_bf4b_ed4c413c2482["InetSocketAddress()"]
  9e6b8f94_acf2_dfd0_61f9_40caaa752ff5 -->|calls| e15de1c5_0b2f_2ddf_bf4b_ed4c413c2482
  style 9e6b8f94_acf2_dfd0_61f9_40caaa752ff5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java lines 219–243

    private NetworkInterface multicastNetworkInterface() throws IOException {
        for (NetworkInterface iface : NetUtil.NETWORK_INTERFACES) {
            if (iface.isUp() && iface.supportsMulticast()) {
                Enumeration<InetAddress> addresses = iface.getInetAddresses();
                while (addresses.hasMoreElements()) {
                    InetAddress address = addresses.nextElement();
                    if (isSupported(socketInternetProtocalFamily(), address)) {
                        MulticastSocket socket = new MulticastSocket(newAnySocketAddress());
                        socket.setReuseAddress(true);
                        socket.setNetworkInterface(iface);
                        try {
                            socket.send(new java.net.DatagramPacket(new byte[] { 1, 2, 3, 4 }, 4,
                                                                    new InetSocketAddress(groupAddress(), 12345)));
                            return iface;
                        } catch (IOException ignore) {
                            // Try the next interface
                        } finally {
                            socket.close();
                        }
                    }
                }
            }
        }
        return null;
    }

Domain

Subdomains

Frequently Asked Questions

What does NetworkInterface() do?
NetworkInterface() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java.
Where is NetworkInterface() defined?
NetworkInterface() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java at line 219.
What does NetworkInterface() call?
NetworkInterface() calls 1 function(s): InetSocketAddress.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free