public static int selectPort(int excludePort){
  		
  		//we'll randomly pick one of the server	that was not selected previously
  		int selectedPort = excludePort;
  		
  		
  		//to avoid getting stuck in the while forever
  		if (selectedPort == 0){
  			selectedPort = port[new Random().nextInt(port.length)];	
  			portsTried = new int[]{selectedPort};
  		}
  		else{
  			
  			if (portsTried.length == port.length){
  				//clear portstried by only keeing the last port
  				//selectedPort = port[new Random().nextInt(port.length)];
  				portsTried = new int[]{portsTried[portsTried.length -1]};
  			}
  				
  			int[] randomPort = new int[port.length - portsTried.length];
  			
  			int index = 0;
  			dontAdd:
  			for (int i = 0; i < port.length; i++){
  				for (int k = 0; k < portsTried.length; k++){
  					
  					if (port[i] == portsTried[k]){
  						continue dontAdd;
  					}													
  				}
  				
  				//add
  				randomPort[index] = port[i];
  				index++;
  			}
  			
  			
  			//now select the randomport
  			selectedPort = randomPort[new Random().nextInt(randomPort.length)];
  			
  			//add selected port to portstried
  			
  			int[] cpyPort = portsTried;
  			
  			portsTried = new int[cpyPort.length + 1];
  			
  			for (int k = 0; k < cpyPort.length; k++){
  				portsTried[k] = cpyPort[k];
  			}
  			
  			portsTried[portsTried.length - 1] = selectedPort;
  				
  				
  			
  		}
  		
  		
  		
  		
  		return selectedPort;
  	}