// 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; }