private String queryServer() throws IOException {

		ih_str = "";
		byte[] info_hash = this.torrentInfo.info_hash.array();
		for (int i = 0; i < info_hash.length; i++) {
			
				ih_str += "%" + this.HEXCHARS[(info_hash[i] & 0xF0) >>> 4]
						+ this.HEXCHARS[info_hash[i] & 0x0F];
		}

		//System.out.println("info hash: " + ih_str);
		
		/*Save the info hash for later usage as an array of bytes*/
		this.info_hash = this.torrentInfo.info_hash.array();
	

		// String query = "announce?info_hash=" + ih_str + "&peer_id=" + host.getPeerID() + "&port=" + host.getPort() + "&left=" + torinfo.file_length + "&uploaded=0&downloaded=0";

		String query=null;
		
		//this makes sure that event is either started, completed, or stopped
		
		if(this.torrentHandler.getBytesDownloaded()==0){
			this.event="started";
		}else if(this.torrentInfo.file_length==0){
			this.event="completed";
		}else{
			this.event="not done yet";  //this is checked in the next method and eliminated 
		}
		
		
		
		if((this.event.equalsIgnoreCase("started")) || (this.event.equalsIgnoreCase("completed")) || (this.event.equalsIgnoreCase("stopped")) ){
			//does nothing if its one of the strings stated above
		}else{
			this.event=null;
		}
		
		
		if(this.event==null){
			query = "announce?info_hash=" + ih_str + "&peer_id=" + this.peer_id + "&port="+this.serverPort+"&left=" + this.torrentInfo.file_length + "&uploaded="+this.torrentHandler.getBytesUploaded()+ "&downloaded="+this.torrentHandler.getBytesDownloaded();
		}else{
			query = "announce?info_hash=" + ih_str + "&peer_id=" + this.peer_id + "&port="+this.serverPort+"&left=" + this.torrentInfo.file_length + "&uploaded="+this.torrentHandler.getBytesUploaded()+ "&downloaded="+this.torrentHandler.getBytesDownloaded()+ "&event="+this.event;
		}
		
		URL urlobj;
		
		urlobj = new URL(this.torrentInfo.announce_url, query);
		
		//System.out.println(urlobj);
		HttpURLConnection uconnect = (HttpURLConnection) urlobj
				.openConnection();
		uconnect.setRequestMethod("GET");
		
		BufferedReader in = new BufferedReader(new InputStreamReader(
				uconnect.getInputStream()));

		StringBuffer response = new StringBuffer();
		

		String inline = "";
		while ((inline = in.readLine()) != null) {

			response.append(inline);

		}
		//System.out.println(peer_id +"\n" +response.toString());
		return response.toString(); //html response 
	}