コード例 #1
0
ファイル: UpnpTester.java プロジェクト: bell/mediaPortal
 DeletePortMappingActionInvocation(Service service) {
   super(service.getAction("DeletePortMapping"));
   try {
     // This might throw an ActionException if the value is of wrong type
     getInput().addValue(null); // NewRemoteHost
     getInput().addValue(new UnsignedIntegerTwoBytes(1234)); // NewExternalPort
     getInput().addValue("TCP"); // NewProtocol
   } catch (ActionException ex) {
     System.err.println(ex.getMessage());
   }
 }
コード例 #2
0
ファイル: UpnpTester.java プロジェクト: bell/mediaPortal
    AddPortMappingActionInvocation(Service service) {
      super(service.getAction("AddPortMapping"));
      try {
        // This might throw an ActionException if the value is of wrong type
        getInput().addValue(null); // NewRemoteHost
        getInput().addValue(new UnsignedIntegerTwoBytes(1234)); // NewExternalPort
        getInput().addValue("TCP"); // NewProtocol
        getInput().addValue(new UnsignedIntegerTwoBytes(1234)); // NewInternalPort

        // TODO: This may return null
        String localhost = NetUtilities.getNonLoopbackAddress().getHostAddress();
        System.out.println("Adding port to : " + localhost);

        getInput().addValue(localhost); // NewInternalClient
        getInput().addValue(true); // NewEnabled
        getInput().addValue("Description"); // NewPortMappingDescription
        getInput().addValue(new UnsignedIntegerFourBytes(0)); // NewLeaseDuration
      } catch (ActionException ex) {
        System.err.println(ex.getMessage());
      }
    }