Prog_Multi_thread

Prog_Multi_thread - /* *Programming Assignment#1 *...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/*********************************************** ****Programming Assignment#1 **** ****Building a Multi-threaded webserver **** ****Prathyusha Aala **** ****E884N488 **** ****pxaala@wichita.edu **** ***********************************************/ import java.io.*; import java.net.*; import java.util.*; public final class Prog_Multi_thread { public static void main(String args[]) throws Exception { int port = 5401; ServerSocket listenSocket = new ServerSocket(port); System.out.println("The Server is running\n"); //Process HTTP service requests in an infinite loop / while(true) { // Construct an object to process the HTTP request message HttpRequest request = new HttpRequest(listenSocket.accept()); // Create a new thread to process the request. / Thread thread = new Thread(request); //Start the thread thread.start(); } } } final class HttpRequest implements Runnable { f final static String CRLF ="\r\n"; Socket socket; public HttpRequest(Socket socket) throws Exception { this.socket = socket;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/30/2010 for the course CS 655 taught by Professor Staff during the Spring '08 term at Wichita State.

Page1 / 3

Prog_Multi_thread - /* *Programming Assignment#1 *...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online