public void put() throws Exception {
		//LOCK ID
		int lockID = ftpServer.putIN_ID(path.resolve(tokens.get(1)));
		if (Main.DEBUG) System.out.println(lockID);
		
		//send message ID
		dStream.writeBytes(lockID + "\n");
		
		
		//////////
		// LOCK //
		//////////
		while (!ftpServer.putIN(path.resolve(tokens.get(1)), lockID))
			Thread.sleep(10);
		
		if (ftpServer.terminatePUT(path.resolve(tokens.get(1)), lockID)) {
			quit();
			return;
		}
		
		//can write
		dStream.writeBytes("\n");
		
		if (ftpServer.terminatePUT(path.resolve(tokens.get(1)), lockID)) {
			quit();
			return;
		}
		
		//get file size
		byte[] fileSizeBuffer = new byte[8];
		byteStream.read(fileSizeBuffer);
		ByteArrayInputStream bais = new ByteArrayInputStream(fileSizeBuffer);
		DataInputStream dis = new DataInputStream(bais);
		long fileSize = dis.readLong();
		
		if (ftpServer.terminatePUT(path.resolve(tokens.get(1)), lockID)) {
			quit();
			return;
		}
		
		//receive the file
		FileOutputStream f = new FileOutputStream(new File(tokens.get(1)).toString());
		int count = 0;
		byte[] buffer = new byte[1000];
		long bytesReceived = 0;
		while(bytesReceived < fileSize) {
			if (ftpServer.terminatePUT(path.resolve(tokens.get(1)), lockID)) {
				f.close();
				quit();
				return;
			}
			count = byteStream.read(buffer);
			f.write(buffer, 0, count);
			bytesReceived += count;
		}
		f.close();
		
		////////////
		// UNLOCK //
		////////////
		ftpServer.putOUT(path.resolve(tokens.get(1)), lockID);
	}