gvsu/cs654/lab3/partA/WebServer.java
josh a82373c0fe cs654/lab3 partA finished
git-svn-id: svn://anubis/gvsu@4 45c1a28c-8058-47b2-ae61-ca45b979098e
2008-02-03 02:47:51 +00:00

31 lines
842 B
Java

import java.io.* ;
import java.net.* ;
import java.util.* ;
public final class WebServer {
public static void main(String argv[]) throws Exception {
int port = 8080;
// Establish the listen socket.
ServerSocket socket = new ServerSocket(port);
// Process HTTP service requests in an infinite loop.
while (true) {
// Listen for a TCP connection request.
Socket connection = socket.accept();
// Construct an object to process the HTTP request message.
HttpRequest request = new HttpRequest(connection);
// Create a new thread to process the request.
Thread thread = new Thread(request);
// Start the thread.
thread.start();
}
}
}