public void send(final ThinClient client) throws IOException {
		// System.out.println("\n=====Sending Message...");
		int maxSize = client.getMTU() - 10 - 42;
		byte[] buffer = new byte[maxSize];
		int type = 1;
		int bufferLength = 16;
		int nextPacketStartAt = 0;

		int size = this.operations.size();
		for (int i = 0; i < size; i++) {
			Operation o = this.operations.get(i);
			if (o instanceof SleepOperation) {
				try {
					Thread.sleep(((SleepOperation) o).getSleepTime(), 0);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				continue;
			}
			try {
				if (!resending) {

					o.setSequence(displayWriterThread.getNextOpcodeSeq(o
							.getSequenceIncrement()));
					client.addToHistory(o);
				}
				int nbCopiedBytes = o.copyStart(buffer, bufferLength);
				int nbBytesMissing = o.getLength() - nbCopiedBytes;
				bufferLength += nbCopiedBytes;
				if (nbBytesMissing > 0) {
					// Sending the packet split
					type = 6;

					// add header
					ByteArrayList.setInt16(buffer, 0, displayWriterThread
							.getNextSeq());
					ByteArrayList.setInt16(buffer, 2, nextPacketStartAt);
					ByteArrayList.setInt16(buffer, 4, type);
					// next 12 bytes are 0

					client.sendBytes(buffer, bufferLength);

					o.copyEnd(buffer, nbBytesMissing, 16);
					bufferLength = nbBytesMissing + 16;

					if (nbBytesMissing == o.getLength()) {
						nextPacketStartAt = 0;
					} else {
						nextPacketStartAt = nbBytesMissing;
					}
				}
			} catch (Throwable t) {
				t.printStackTrace();
				new IllegalStateException("Failed to process operation:" + o);
			}
		}
		if (bufferLength > 0) {

			// add header
			ByteArrayList.setInt16(buffer, 0, displayWriterThread.getNextSeq());
			ByteArrayList.setInt16(buffer, 2, nextPacketStartAt);
			ByteArrayList.setInt16(buffer, 4, type);
			// next 12 bytes are 0
			client.sendBytes(buffer, bufferLength);
		}
		// System.out.println("=====Sending Message done...");
	}