public void run(){
		output.println("Connected");
		String inputLine;
         try {
			while ((inputLine = input.readLine()) != null) {
			 	if (inputLine.equals("Combine file.")){
			 		System.out.println("Combining file.");
			 		ShamirShare fileShares = getAllFileSlice();
			 		ShamirShare toCombine = new ShamirShare();
			 		toCombine.combine(fileShares);
			 		break;
			 	}
			 	if (inputLine.equals("Split file.")){
			 		System.out.println("Splitting file.");
			 		String fileName = input.readLine();
			 		int fileSize = Integer.parseInt(input.readLine());
			 		splitFile(fileName, fileSize, socket);
			 		output.println("File splitting done.");
			 		break;
			 	}	
			 	if (inputLine.equals("Sending shares.")){ 
			 		System.out.println("Receiving shares from "+socket.getInetAddress());
			 		ShamirShare secretShare = new ShamirShare();
			 		secretShare.setFileName(input.readLine());
			 		secretShare.setNoOfShares(Integer.parseInt((input.readLine())));
			 		secretShare.setPrime(new BigInteger(input.readLine().getBytes()));
			 		secretShare.setThreshold(Integer.parseInt((input.readLine())));
			 		BigInteger tempPrime = new BigInteger(input.readLine().getBytes());
			 		int tempIndex = Integer.parseInt((input.readLine()));
			 		Share tempShare = new Share(tempIndex, tempPrime);
			 		ArrayList<Share> tempArray = new ArrayList<Share>();
			 		tempArray.add(tempShare);
			 		secretShare.setShareArr(tempArray);
			 		output.println("Acknowledged.");
			 		localFileSlice(secretShare);
			 		break;
			 	}
			 	if (inputLine.equals("Give me slice.")){
			 		System.out.println("Sending file slice.");
			 		ShamirShare local = getLocalSlice();
			 		output.println(""+local.getShareArr().get(0).getShareIndex());
			 		output.println(new String(local.getShareArr().get(0).getShare().toByteArray()));
			 		break;
			 	}
			 }
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}