Ejemplo n.º 1
0
  public void addPortMapping(
      int externalPort, String internalClient, int internalPort, int leaseDurationSeconds)
      throws Exception {

    router.addPortMapping(
        "Subsonic", null, internalPort, externalPort, internalClient, leaseDurationSeconds, "TCP");
  }
Ejemplo n.º 2
0
  public static SBBIRouter findRouter() throws Exception {
    InternetGatewayDevice[] routers;
    try {
      routers = InternetGatewayDevice.getDevices(DISCOVERY_TIMEOUT);
    } catch (IOException e) {
      throw new Exception("Could not find router", e);
    }

    if (routers == null || routers.length == 0) {
      throw new Exception("No routers found");
    }

    if (routers.length != 1) {
      throw new Exception("Found more than one router (" + routers.length + ")");
    }

    return new SBBIRouter(routers[0]);
  }