@Override
	public void run() {
		try{
			_user = new ClientUDP();
			_user.sendToServer(new MessageUDP(_CSName, _CSPort, Protocol.LIST + "\n"));
			System.out.println(">> Sent list");
			_bufferUDP = _user.receiveFromServer();
			_arguments = _bufferUDP.getMessage().split(" ");
			if(_arguments[0].equals(Protocol.LIST_RESPONSE)){
				if(_arguments.length > 4){
					User.setSS(_arguments[1], Integer.parseInt(_arguments[2]));
					int numFiles = Integer.parseInt(_arguments[3]);
					System.out.println("Available files for download:");
					for(int i = 1; i <= numFiles; i++){
						System.out.println(i + " " + _arguments[3+i]);
					}
				}
			}
			else if(_arguments[0].startsWith(Protocol.ERROR)){
				System.out.println(Errors.INVALID_PROTOCOL);
				System.exit(-1);
			}
			else if(_arguments[0].startsWith(Protocol.EOF)){
				System.out.println(Errors.SERVER_BUSY);
			}
			else{
				System.out.println(Errors.INVALID_COMMAND);
			}
		} catch (IOException e){
			e.printStackTrace();
			System.err.println(Errors.IO_PROBLEM);
			System.exit(-1);
		} finally{
			try {
				_user.close();
			} catch (IOException e) {
				System.err.println(Errors.IO_PROBLEM);
				System.exit(-1);
			}
		}
		
	}