public static void main(String[] args) throws IOException {

    	String hostName = args[0];	//localhost
    	
    	Checker checker = new PortChecker();
    	int port = checker.check(args[1]);
    	
        Socket socket = new Socket(hostName, port);
        BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
        
        Scanner menu = new Scanner(System.in);
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        
        System.out.println("MENU:");
        System.out.println("1. Give me a name");
        System.out.println("2. Quit");       
        
        boolean flag = true;
        int menuIndex;
        while (flag) {
        	menuIndex = menu.nextInt();
			switch (menuIndex) {
			case 1:
				name = in.readLine();
				ClientData clientData = new ClientData();
				clientData.setName(name);
				/* here */
				output.writeObject(clientData);
            	output.flush();
				flag = false;
				break;
			case 2:
				quit(socket, input, output, menu, in);
			}
		}
        
		while (true) {
			
	        System.out.println("MENU:");
			System.out.println("1. Send message to server");
			System.out.println("2. Print message from server");
			System.out.println("3. Quit");
			
			menuIndex = menu.nextInt();
	        switch(menuIndex){
	        	case 1:	
	            	message = in.readLine();
	            	ClientData clientData = new ClientData();
	            	clientData.setName(name);
	            	clientData.setMessage(message);
	            	output.writeObject(clientData);
	            	output.flush();
	            	break;
	        	case 2: 
	        		String serverMsg = input.readLine();
	        		System.out.println(serverMsg);
	        		break;
	        	case 3:	
					quit(socket, input, output, menu, in);
	        }
		}
    }