public void sendData(Object dataObject) {
		this.dataToSend = dataObject;

		byte[] data = null;
		byte[] lengthPacket = null;

		try {
			// serialize the data to be sent
			data = NetworkPacketManager.serialize(dataToSend);

			// compute the length of the package
			lengthPacket = NetworkPacketManager.packetLength(data);

		} catch (IOException e) {
			loggerNetworkClient.error("Error serializing object");
			e.printStackTrace();
		}

		sizeToWrite = data.length;
		offset = 0;

		loggerNetworkClient.info("I want to write " + data.length
				+ " bytes on the socket associated with the key " + key);

		synchronized (key) {
			wbuf.add(lengthPacket);
			wbuf.add(data);

			if (key != null)
				key.interestOps(SelectionKey.OP_WRITE);
		}
		selector.wakeup();
	}