SDSU CS 596: Client-Server Programming
Spring Semester, 1997
Doc 6, Hinges and Servers

To Lecture Notes Index
San Diego State University -- This page last updated Feb 13, 1997
----------

Contents of Doc 6, Hinges and Servers


Doc 6, Hinges and Servers Slide # 1
Socket Library

Java's socket library is simple and easy to use:

Socket(hostname, portNumber)
Socket(hostAddress, portNumber)

close()
getInputStream()
getOutputStream()
getLocalPort()

If your development language or system does not have such good socket library either buy one or write


Doc 6, Hinges and Servers Slide # 2
Server Architecture

basic application



basic client/Server structure


Doc 6, Hinges and Servers Slide # 3
Server with Hinge




Network Interface

ServerSocket acceptor = new ServerSocket(0);
System.out.println("On port " + acceptor.getLocalPort());
     while (true)
     {
     Socket client = acceptor.accept();
     clientAction(client.getInputStream(),
               client.getOutputStream());
     client.close();
     }


Application Code


clientAction(InputStream in, OutputStream out)
     {
     //Work done here
     }


Doc 6, Hinges and Servers Slide # 4
Some Possible Hinges



client application

debuging

inetd

----------