public void transaction() throws Exception
	{
		boolean done = false;
		System.out.println("Début de la transaction");
		messagePacket = Packet.Create(MessageType.NACK, Sequence, new byte[0], WIN-1, '0');
		message = messagePacket.getUDPdata();
		tx(dataSocket, message);
		while(!done)
		{	
			try
			{	
				System.out.println("Activer le timeout");
				dataSocket.setSoTimeout(DELAY);
				rx(dataSocket, data);
				System.out.println("Paquet recu");
				if (Sequence%MODULO == dataPacket.getSequence())
				{
					if (dataPacket.CRCValid() && !CRCError(error))
					{
						System.out.println("ecriture des data recu "+Sequence%MODULO+" "+ dataPacket.getSequence());
						System.out.println(dataPacket.getData().toString());
						System.out.println(dataPacket.getData());
						for(int i=0 ; i<dataPacket.getData().length ; i++)
						{
							file.write(dataPacket.getData()[i]);
						}
						if (dataPacket.getData().length != PAYLOADLENGTH)
						{
							done = true;
						}
						//System.out.println("Incrémentation de la Sequence");
						Sequence++;
						//System.out.println("Création de l'ACK");
						messagePacket = Packet.Create(MessageType.ACK, Sequence%MODULO, new byte[0],WIN-1, '0');
						//System.out.println("Encapsulation de l'ACK");
						message = messagePacket.getUDPdata();
						System.out.println("Envoie de l'ACK " + Sequence);
						tx(messageSocket, message);
					}
					else
					{
						System.out.println("CRC erroné !!!");
						NACK();
					}
				}
			}
			catch (Exception e)
			{
				System.err.println("Erreur :" + e);
			}
		}
		file.close();
		messageSocket.close();
		dataSocket.close();
		System.out.println("Transaction terminée");
	}