import java.net.*; import java.io.*; /* ******************************************************************* Bert G. Wachsmuth June 3, 1996 Simple server to connect through TCPIP on a socket. The server will wait for a connection, serve that connection, then wait for the next connection in line. The server understands the following commands: get: server sends a knock-knock joke bye: server closes thread for a connection, waits for next one shutdown: server shuts down completely, no more connections possible Some of the code is taken from the SUN online Java tutorial. The server consists of two classes: JokeServer: the main program simply starts a JokeHandler thread JokeHandler: the thread waits for a new connection, serves it, and waits for next connection ******************************************************************* */ class JokeServer { public static void main(String args[]) { System.out.println("JokerServer (c) Bert Wachsmuth, 1996"); System.out.println(" ... thanks to the JavaSoft Tutorial"); new JokeHandler().start(); } } /* ******************************************************************* */