public synchronized MessageBlock getNextBlock(final int size, final long time) {
		int length = size;
		int offset = currentOffset;

		/*
		 * Search first for block to resent.
		 */
		MessageBlock mb = checkForMissingBlocks(size, time);
		if (mb != null)
			return mb;

		/*
		 * Then send the next block if available.
		 */
		if (currentOffset + length > binaryData.length) {
			length = binaryData.length - currentOffset;

			if (length <= 0)
				return null;

			currentOffset = binaryData.length;
		} else {
			currentOffset += length;
		}

		sentBlocks.add(new MessageBlockDef(offset, length));

		return sendBlock(offset, length);

	}