public void run(){
		byte arr1[] = new byte[576];
		dack = new DatagramPacket(arr1, arr1.length);
		
		try{
			//keeps reading from server
			while (lBound<totPacket){
				dsock.receive(dack); // receive the packet 
				byte[] data = dack.getData();
				int ack = getAcknowledgmentNumber(data);
				
				receivedTime[ack] = new Date();
				
				if(ack == lBound){
						lBound++;
					if(uBound < totPacket -1)
						uBound++;
					
					//update timeout; Tnew = 0.25 * Told + 0.75 * RTT
					timeout = (long)0.25 * timeout + (long)0.75 * (receivedTime[ack].getTime() - sendTime[ack].getTime());

					//write to log file
					if(toLog != null)
						toLog.println(Sender.toString(data) + ", RTT: " + (receivedTime[ack].getTime() - sendTime[ack].getTime()) + "ms");
					else
						System.out.println(Sender.toString(data) + ", RTT: " + (receivedTime[ack].getTime() - sendTime[ack].getTime()) + "ms");
				}
			}
			
		}catch(Exception e){
			System.err.println(e);
		}
	}