// Send data message to the all nodes on the channel.
  public boolean sendDataToAll(String toChannel, byte[] buf) {
    if (mChord == null) {
      Log.v(TAG, "sendDataToAll : mChord IS NULL  !!");
      return false;
    }

    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(toChannel);
    if (null == channel) {
      Log.e(TAG, TAGClass + "sendDataToAll : invalid channel instance");
      return false;
    }

    byte[][] payload = new byte[1][];
    payload[0] = buf;

    Log.v(TAG, TAGClass + "sendDataToAll : " + new String(buf));

    /*
     * @param payloadType User defined message type. It is mandatory.
     * @param payload The package of data to send
     * @return Returns true when file transfer is success. Otherwise, false
     * is returned.
     */
    if (false == channel.sendDataToAll(CHORD_APITEST_MESSAGE_TYPE, payload)) {
      Log.e(TAG, TAGClass + "sendDataToAll : fail to sendDataToAll");
      return false;
    }

    return true;
  }
  // Requests for nodes on the channel.
  public List<String> getJoinedNodeList(String channelName) {
    Log.d(TAG, TAGClass + "getJoinedNodeList()");
    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(channelName);
    if (null == channel) {
      Log.e(TAG, TAGClass + "getJoinedNodeList() : invalid channel instance-" + channelName);
      return null;
    }

    return channel.getJoinedNodeList();
  }
  // Reject to receive file.
  public boolean rejectFile(String fromChannel, String coreTransactionId) {
    Log.d(TAG, TAGClass + "rejectFile()");
    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(fromChannel);
    if (null == channel) {
      Log.e(TAG, TAGClass + "cancelFile() : invalid channel instance");
      return false;
    }

    // @param exchangeId Exchanged ID
    return channel.rejectFile(coreTransactionId);
  }
  // Cancel file transfer while it is in progress.
  public boolean cancelFile(String channelName, String exchangeId) {
    Log.d(TAG, TAGClass + "cancelFile()");
    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(channelName);
    if (null == channel) {
      Log.e(TAG, TAGClass + "cancelFile() : invalid channel instance");
      return false;
    }

    // @param exchangeId Exchanged ID
    return channel.cancelFile(exchangeId);
  }
  // Get an IPv4 address that the node has.
  public String getNodeIpAddress(String channelName, String nodeName) {
    Log.d(
        TAG,
        TAGClass + "getNodeIpAddress() channelName : " + channelName + ", nodeName : " + nodeName);
    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(channelName);
    if (null == channel) {
      Log.e(TAG, TAGClass + "getNodeIpAddress : invalid channel instance");
      return "";
    }

    /*
     * @param nodeName The node name to find IPv4 address.
     * @return Returns an IPv4 Address.When there is not the node name in
     * the channel, null is returned.
     */
    return channel.getNodeIpAddress(nodeName);
  }
  // Accept to receive file.
  public boolean acceptFile(String fromChannel, String exchangeId) {
    Log.d(TAG, TAGClass + "acceptFile()");
    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(fromChannel);
    if (null == channel) {
      Log.e(TAG, TAGClass + "acceptFile() : invalid channel instance");
      return false;
    }

    /*
     * @param exchangeId Exchanged ID
     * @param chunkTimeoutMsec The timeout to request the chunk data.
     * @param chunkRetries The count that allow to retry to request chunk
     * data.
     * @param chunkSize Chunk size
     */
    return channel.acceptFile(exchangeId, 30 * 1000, 2, 300 * 1024);
  }
  // Send file to the node on the channel.
  public String sendFile(String toChannel, String strFilePath, String toNode) {
    Log.d(TAG, TAGClass + "sendFile() ");

    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(toChannel);
    if (null == channel) {
      Log.e(TAG, TAGClass + "sendFile() : invalid channel instance");
      return null;
    }
    /*
     * @param toNode The node name that the file is sent to. It is
     * mandatory.
     * @param fileType User defined file type. It is mandatory.
     * @param filePath The absolute path of the file to be transferred. It
     * is mandatory.
     * @param timeoutMsec The time to allow the receiver to accept the
     * receiving data requests.
     */
    return channel.sendFile(
        toNode, MESSAGE_TYPE_FILE_NOTIFICATION, strFilePath, SHARE_FILE_TIMEOUT_MILISECONDS);
  }
  // Send data message to the node.
  public boolean sendData(String toChannel, byte[] buf, String nodeName) {
    if (mChord == null) {
      Log.v(TAG, "sendData : mChord IS NULL  !!");
      return false;
    }
    // Request the channel interface for the specific channel name.
    IChordChannel channel = mChord.getJoinedChannel(toChannel);
    if (null == channel) {
      Log.e(TAG, TAGClass + "sendData : invalid channel instance");
      return false;
    }

    if (nodeName == null) {
      Log.v(TAG, "sendData : NODE Name IS NULL !!");
      return false;
    }

    byte[][] payload = new byte[1][];
    payload[0] = buf;

    Log.v(TAG, TAGClass + "sendData : " + new String(buf) + ", des : " + nodeName);

    /*
     * @param toNode The joined node name that the message is sent to. It is
     * mandatory.
     * @param payloadType User defined message type. It is mandatory.
     * @param payload The package of data to send
     * @return Returns true when file transfer is success. Otherwise, false
     * is returned
     */
    if (false == channel.sendData(nodeName, CHORD_APITEST_MESSAGE_TYPE, payload)) {
      Log.e(TAG, TAGClass + "sendData : fail to sendData");
      return false;
    }

    return true;
  }