Class MTU

  • public class MTU
    extends Object
    Get the MTU for the network interface of an address. Not available until Java 6 / Android API 9. Public only for command line test. Not for external use, not a public API.
    0.9.2. public since 0.9.27
    • Method Detail

      • getMTU

        public static int getMTU​(InetAddress ia)
        The MTU for the socket interface, if available. Not available for Java 5. Note that we don't return the value for the default interface if we can't find the address. Finding the default interface is hard, altough we could perhaps just look for the first non-loopback address. But the MTU of the default route probably isn't relevant.
        ia - null ok
        0 if Java 5, or if not bound to an address; limited to range MIN_MTU to LARGE_MTU.
      • rectify

        public static int rectify​(boolean isIPv6,
                                  int mtu)
        min of PeerState.MIN_MTU, max of PeerState.LARGE_MTU, rectified so rv % 16 == 12 (IPv4) or rv % 16 == 0 (IPv6)
      • main

        public static void main​(String[] args)