Class UPnP4J

java.lang.Object
dev.omega24.upnp4j.UPnP4J

public class UPnP4J extends Object
The class to manage upnp4j from
  • Constructor Details

    • UPnP4J

      public UPnP4J()
  • Method Details

    • initialize

      public static void initialize()
      Initialize a connection to the router
    • isUPnPAvailable

      public static boolean isUPnPAvailable()
      Checks if UPnP is available for the router
      Returns:
      True if UPnP is available
    • getExternalIP

      public static String getExternalIP()
      Gets the external IP of the router
      Returns:
      The external IP of the router
    • getLocalIP

      public static String getLocalIP()
      Gets the local IP of the router
      Returns:
      The local IP of the router
    • open

      public static boolean open(int port, Protocol protocol)
      Opens a port using UPnP
      Parameters:
      port - A port in the range of 1-65535
      protocol - The protocol to open the port with
      Returns:
      True if the port was able to open
    • isOpen

      public static boolean isOpen(int port, Protocol protocol)
      Checks if a port is open
      Parameters:
      port - A port in the range of 1-65535
      protocol - The protocol to check the port with
      Returns:
      True if the port is open
    • close

      public static boolean close(int port, Protocol protocol)
      Closes a port using UPnP
      Parameters:
      port - A port in the range of 1-65535
      protocol - The protocol to close the port with
      Returns:
      True if the port was able to close