SDSU CS 596 Client-Server Programming
Assignment 5 Comments

[To Lecture Notes Index]
San Diego State University -- This page last updated April 9, 1996

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" );

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 ()

			// Do server stuff in here

		catch (IOException e) 
			{  // What to do here? }


Who does what?

Is this Master/ Slave programming?

VT100 terminals
A View of Program Responsibilities

User Interface Module
Controls all user interaction

Logic Modules
Presentation Logic
Displays graphical output and processes user input
Computational Logic
Does computation tasks of the program
Information Logic
Accesses the information storage system
Determines how to access storage system
Determines what to store
Determines what to retrieve
Create a query to send to a database (for example)

Information Storage and Retrieval
Actually reads and writes data from storage devices