Class PortMappingUtil


  • public class PortMappingUtil
    extends Object
    Class for the creation of port mappings to make local services externally/publicly accessible.
    • Method Detail

      • expose

        public static Set<PortMappingUtil.PortMapping> expose​(InetSocketAddress address,
                                                              PortMappingUtil.Protocol protocol)
        Exposes address via PCP, NAT-PMP, or UPNP-IGD. This operation scans the local network for relevant routers. If no devices are discovered or no port forwardings can be created, this method will return an empty set.

        Note: This is a blocking method, because it connects to other devices that may react slowly or not at all.

        Parameters:
        address - address to be exposed
        protocol - protocol to be exposed
        Returns:
        List of port mappings.