code: synchronized public int getTransactionID() {
          /*
           * Ensure that the transaction ID is in the valid range between
           * 0 and MAX_TRANSACTION_ID (65534).  If not, the value will be forced
           * to 0.
           */
          if (transactionID < Modbus.DEFAULT_TRANSACTION_ID && isCheckingValidity()) {
              transactionID = Modbus.DEFAULT_TRANSACTION_ID;
          }
          if (transactionID >= Modbus.MAX_TRANSACTION_ID) {
              transactionID = Modbus.DEFAULT_TRANSACTION_ID;
          }
          return transactionID;
      }
docs: getTransactionID -- get the next transaction ID to use.
  @return next transaction ID to use