public void sendFile(String localFileName, String fileOnServer) throws IOException {
		
		File file = new File(rootFolder, localFileName);
		if(! file.exists()) {
			throw new FileNotFoundException("File " + localFileName + " not found in the root folder " + rootFolder.getAbsolutePath());
		}
		
		if(file.isDirectory()) {
			throw new IOException("Writing whole folders isn't supported. Please send each file individually.");
		}
		
		try(DatagramSocket clientSocket = new DatagramSocket()) {
			Sender sender = new Sender(clientSocket, GlobalConfig.TFTP_CONTROL_PORT, serverAddress);
			sender.sendObject(new WRQ(fileOnServer));
			
			byte[] buff = new byte[256];
			DatagramPacket datagram = new DatagramPacket(buff, buff.length);
			clientSocket.setSoTimeout(GlobalConfig.TIMEOUT_MS);
			try {
				clientSocket.receive(datagram);
			}
			catch(SocketTimeoutException e) {
				throw new SocketTimeoutException("Server didn't respond to our request to write "
						+ localFileName + " as " + fileOnServer + " in time.");
			}
			
			Object response = ObjectUtil.extractFromDatagram(datagram);
			if(response instanceof ERR) {
				ERR err = (ERR)response;
				if(err.errorCode == ERR.FILE_ALREADY_EXISTS) {
					throw new FileAlreadyExistsException("Cannot write to server: " + err.message);
				}
				else {
					throw new IOException("Cannot write to server: " + err.message);
				}
			}
			else if(response instanceof ACK) {
				Logger.log("Got the green light to write to the server!");
				try(Scanner s = new Scanner(file)) {
					s.useDelimiter("\\Z");
					String textContents = s.next();
					byte[] fileBytes = textContents.getBytes();
					
					try {
						TimeUnit.MILLISECONDS.sleep(100);
					} catch (Exception e) {
						e.printStackTrace();
					}
					
					int dataLinkPort = datagram.getPort();			
					Logger.log("Sending file to server @ port " + dataLinkPort);
					Sender fileSender = new Sender(clientSocket, dataLinkPort, serverAddress);
					
					try {
						FileSender.sendFile(fileBytes, fileSender);
					} catch(IOException e) {
						throw new IOException("Failed to send file to server: " + e.getMessage());
					}
				}
				Logger.log("Done sending.");
			}
		}
	}