import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import www.Httpd10WorkerBase; public class Httpd10Base { /** * @param args */ public static void main(String[] argv) { ServerSocketChannel listenChannel; ServerSocket listenSocket; SocketChannel rwChan; Httpd10WorkerBase myWorker; InetSocketAddress rcvAddress; boolean debug = false; if (argv.length < 1) { System.out.println("usage: java"+ Httpd10Base.class.getName()+"[-v] "); return; } if(argv.length == 2){ debug = true; argv[0] = argv[1]; } try { /* TODO * initializes connection channel to allow client to connect to the server * portnumber is in argv[0] */ while (true) { // accepts one incoming connection if(debug) System.out.println("Waiting for connection request..."); /* TODO * accepts connection */ if(debug)System.out.println("Connection request accepted..."); /* TODO * Treats one request using 10Worker and closes connection */ } } catch (Exception ie) { /* IOException */ ie.printStackTrace(); } return; } }