title: Multithreading Socket communication Client/Server
body: <p>I finished writing a Client/Server Socket communication program that works fine.  Now I'm trying to figure out how to make it so that I can have multiple Client connections to the Server at once.  I've looked around and there seems to be more than a couple of different ways to do this. so I've come here to ask you guys for help/suggestions.</p>
  
  <p>My Server:</p>
  
  <pre><code>public class Server {
      private ServerSocket serverSocket = null;
      private Socket clientSocket = null;
  
      public Server() {
          try {
              serverSocket = new ServerSocket(7003);
          } catch (IOException e) {
              System.err.println("Could not listen on port: 7003");
              System.exit(1);
          }
  
          try {
              clientSocket = serverSocket.accept();
          } catch (IOException e) {
              System.err.println("Accept failed");
              System.exit(1);
          }
      }
  
      public void startServer() throws IOException {
          PrintWriter output = new PrintWriter(clientSocket.getOutputStream(), true);
          BufferedReader input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  
          String inputLine, outputLine;
  
          outputLine = "Connected to Server";
          output.println(outputLine);
  
          while ((inputLine = input.readLine()) != null) {
              // This just determines users input and server ruturns output based on that
  
              outputLine = this.getServerOutput(inputLine);
              output.println(outputLine);
  
              if (outputLine.equals("Bye"))
                  break;
          }
  
          output.close();
          input.close();
          clientSocket.close();
          serverSocket.close();
      }
  }
  </code></pre>
  
  <p>Would I need to make my constructor create threads and <code>startServer()</code> or would be my run method?</p>