import java.net.*; public class HTTPServer { public static void main(String a[]) throws Exception { final int httpd = 80; ServerSocket ssock = new ServerSocket(httpd); System.out.println("have opened port 80 locally"); Socket sock = ssock.accept(); System.out.println("client has made socket connection"); // Uncomment/recomment each of the three options below in turn. // 1. simple acceptance of Browser request // OneConnection client = new OneConnection(sock); // String s = client.getRequest(); // 2. Server responds to browser with filename // OneConnection client = new OneConnection_A(sock); // String s = client.getRequest(); // 3. Server responds to browser with file contents OneConnection client = new OneConnection_B(sock); String s = client.getRequest(); client.sendFile(s); } }