@Override
	public void sendFileToBuyer(String buyer, String serviceName, String seller) {
		loggerNetwork.info("send file to buyer");
		
		long length;
		int offset, numRead;
		
		byte[] fileBytes;
		
		String filename = serviceName;
		File verifyFile = new File(filename); 
		InputStream serviceFile = null;
		
		try {
			serviceFile = new FileInputStream(filename);
		} catch (FileNotFoundException e1) {
			System.err.println("Error opening file's inputStream");
			e1.printStackTrace();
		}
		
		if (!verifyFile.exists()) {
			System.err.println("File doesn't exist");
			return;
		}
		
		//verify length of the file
		length = verifyFile.length();
		if(length > Integer.MAX_VALUE) {
			loggerNetwork.error("File is too large");
		}
		
		fileBytes = new byte[(int)length];
		offset = 0;
		
		//read the file into a byte array
		try {
			while (offset < fileBytes.length && 
					(numRead = serviceFile.read(fileBytes, offset, fileBytes.length - offset) ) >= 0) {
				offset += numRead;
			}
		} catch (IOException e) {
			System.err.println("Error reading input file");
			e.printStackTrace();
		}
		
		
		//put the byte into an object and send it
		FileService fileObj = new FileService();
		fileObj.fileContent = fileBytes;
		fileObj.fileName = filename;
		fileObj.buyer = buyer;
		fileObj.seller = seller;
		fileObj.serviceName = serviceName;
		
		med.startFileTransfer(serviceName, buyer);

		netClient.sendData(fileObj);

	}