@Override
	public void recvFileTransfer(String seller, String serviceName, byte[] fileContent) {
		loggerNetwork.info("Receive file from seller " + seller + 
				" from service " + serviceName);
		
		String filename = seller + "_" + serviceName;
		int toWrite;
		int noChunks = fileContent.length/NetworkInfo.BUF_SIZE;
		int chunkSize = fileContent.length/noChunks;
		int offset = 0;
		
		try {
			File outFile = new File(filename);
			if (outFile.exists()) {
				outFile.createNewFile();
			}
			
			// write the byte stream into memory
			FileOutputStream receivedFile = new FileOutputStream(filename);

			for (; offset !=  fileContent.length; ){
				if ( fileContent.length - offset < chunkSize) 
					toWrite = fileContent.length - offset;
				else
					toWrite = chunkSize;
				receivedFile.write(fileContent, offset, toWrite);
				
				offset += toWrite;
				
				//announce the gui about the progress of writing the file
				med.acceptFileTransfer(serviceName, 100 * offset / fileContent.length);
			}
			
			receivedFile.close();

		} catch (FileNotFoundException e) {
			System.err.println("Error opening outputstream");
			e.printStackTrace();
		} catch (IOException e) {
			System.err.println("Error writing file on disk");
			e.printStackTrace();
		}
	}