public static void main(String[] args){
		try {
			//prompt for IP address
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			System.out.println("Enter server's IP");
			String ip = reader.readLine();
			if(!ip.trim().equals("")){
				server_ip = ip;
			}

			//connect to server
			String eid = "njc487";

			if(args.length == 1){
				eid = args[0];
			}
			System.out.println("My eid is " + eid);
			System.out.println("Connecting to " + server_ip);
			int port = Integer.parseInt(server_ip.split(":")[1]);
			String ia = server_ip.split(":")[0];
			Socket socket = new Socket(ia, port);

			ObjectInputStream input = new ObjectInputStream(new BufferedInputStream(socket.getInputStream()));
			ObjectOutputStream output = new ObjectOutputStream(new BufferedOutputStream(socket.getOutputStream()));


			Answer dummyAnswer = new Answer(0, Integer.MAX_VALUE, eid);
			output.writeObject(dummyAnswer);
			//prevent InputStream on the server from blocking
			output.flush();

			System.out.println("Waiting for clicker id.");
			Question question = (Question) input.readObject();
			if(question.message == true){
				clicker_id = question.clicker_id;
				System.out.println("Clicker id assigned by server: " + clicker_id);
			}

			System.out.println("Waiting for question.");
			question = (Question) input.readObject();
			while(question != null){
				System.out.println(question);
				//read answer choice (blocks until user hits enter)
				int choice = readAnswer(reader, question.size());
				Answer answer = new Answer(choice, question.id, eid);
				//send back to the server
				output.writeObject(answer);
				output.flush();
				//wait for next question (block here)
				System.out.println("Answer sent. Waiting for next question.");
				question = (Question) input.readObject();
			}


		} catch(EOFException e){
				System.out.println("Server disconnected.");
	
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 


	}