Wednesday, February 22, 2012

Programming Project 1: Multi-threaded Webserver Part 2

WebServer.java


package clavetter;
import java.io.*;
import java.util.*;
import java.net.*;



public class WebServer{

   
    public static void main(String[] args) throws Exception {
   

        int port = 80;
        ServerSocket wS = new ServerSocket(port);
       
       
       
        while(true) {
            Socket cS = wS.accept();
            HttpRequest request = new HttpRequest(cS);
            Thread thread = new Thread(request);
            thread.start();
           
           
        }      
    }
}


No comments:

Post a Comment