Package org.bitlet.weupnp

Examples of org.bitlet.weupnp.PortMappingEntry


            // remove my previous mapping when port changes
            removeSarosPortMapping();
        } else if (currentlyMappedPort == 0) {
            // first time mapping, lets check if mapped port is free
            try {
                PortMappingEntry portMapping = upnpAccess
                    .getSpecificPortMappingEntry(selectedGateway, port, "TCP");
                if (portMapping != null) {

                    // There is already a port mapping!

                    // If it has Saros description then remove it else abort
                    String desc = portMapping.getPortMappingDescription();
                    if ((desc != null && desc.equals(MAPPINGDESC)))
                        selectedGateway.deletePortMapping(port, "TCP");
                    else {
                        log.debug("There is already a port mapping for the port ("
                            + port + ") configured. Port mapping aborted.");
                        selectedGateway.deletePortMapping(port, "TCP");
                        discoveryRunningSemaphore.release();
                        return false;
                    }
                }
            } catch (Exception e) {
                log.debug("Error performing port mapping:" + e.getMessage());
            }
        }

        try {
            InetAddress localAddress = selectedGateway.getLocalAddress();

            PortMappingEntry portMapping = upnpAccess
                .getSpecificPortMappingEntry(selectedGateway, port, "TCP");

            if (portMapping == null) {

                int errorcode = upnpAccess.addPortMapping(selectedGateway,
View Full Code Here

TOP

Related Classes of org.bitlet.weupnp.PortMappingEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.