title: How to read lines of input from server? (java client console application)
body: <p>I've connected to an already existent server that contains lines of strings I need to read in. Given that I only need to read in a String type, which input reader would work here so I could read line by line in my While loop? Here's my simple Client:</p>
  
  <pre><code>public class Client
  {
  public static final int PORT_NUMBER = 8888;
  
  
  public static void main(String[] args)
  {
   int port = PORT_NUMBER;
   String content;
   OutputStream output;
   InputStream input;
   Socket s = null;
  
  try
  {
   s = new Socket("server.example.exp", port);
   output = s.getOutputStream();
   input = s.getInputStream();
  
   System.out.println("Connected to " + s.getInetAddress() + " on port " + s.getPort());
  }
  catch (IOException e) {System.err.println(e);}
  
  while (true)
  {
   try
   {
    //read next line from server
   }
   catch (EOFException eof){
    System.out.println("eof encountered" + eof.getMessage());
    break;
   }
   catch (OptionalDataException ode){System.out.println("OptionalDataException" + ode.getMessage());}
   catch (IOException ioe){System.out.println("IOException on read object");}
   catch (ClassNotFoundException cnf){System.out.println("ClassNotFoundException");}
  }
  
  
    }
  }
  </code></pre>
  
  <p>I know it's a very basic question, I'm just having trouble getting started, is all. I appreciate any clarification. Thanks.</p>