class SumServer { static int portNumber = 4444; public static void main(String args[]) { ServerSocket serverSocket; serverSocket = serverSocketOn( portNumber ); Socket clientSocket = null; InputStream fromClient; OutputStream toClient; while ( true ) { clientSocket = acceptClientRequestOn( serverSocket ); fromClient = inputStreamFromClient( clientSocket ); toClient = outputStreamToClient( clientSocket ); processClientRequest( fromClient, toClient ); } } protected static void processClientRequest( InputStream in, OutputStream out ) { SumHandler adder = new SumHandler( in, out); Thread serverThread = new Thread( adder, "Add" ); serverThread.start(); } class SumHandler implements Runnable { protected ASCIIInputStream cin; protected PrintStream cout; public SumHandler( InputStream in, OutputStream out ) { cin = new ASCIIInputStream( in ); cout = new PrintStream( out, false); } public void run () { try { // Do server stuff in here } catch (IOException e) { // What to do here? } } }