예제 #1
0
  /** This method updates the TXT records of the previously created service */
  public void updateService() throws Exception {
    int result;
    // TXT records
    Vector<String> records = new Vector<String>();

    // update records
    records.add("record1=1");
    records.add("UpdatedRecord2=NewUpdatedValue2");
    System.out.println("\n\nUpdating service");
    result =
        group.updateService(
            Avahi4JConstants.AnyInterface,
            Protocol.ANY,
            "TestService",
            "_test._tcp",
            null,
            records);
    if (result != Avahi4JConstants.AVAHI_OK) {
      System.out.println("Error updating service: " + Avahi4JConstants.getErrorString(result));
    } else {
      System.out.println("done");
    }
  }