Skip to content

This project aims at developing a socket program that implements a multi-threaded Web service using HTTP protocol, without using ServerSocket.

License

Notifications You must be signed in to change notification settings

bardzjhe/Multi-thread-Web-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-threaded Web Server

Given the high performance of threads in modern VM and operating systems, as well as the relative simplicity of building a thread-based server, a thread-based server is usually where we should start with until we are hitting a wall.

This project aims to develop a socket program to implement a multithreaded Web service using the HTTP protocol, without using ServerSocket in java.net.

Getting started

The Project consists of 2 JAVA classes for server socket:

  1. Server.java
  2. HttpRequest.java You may create a new standard JAVA project called Multi-ThreadedWebServer first, and put these two files into the src folder.

Also, a client socket is available for testing multithreading features.

Preparation

  1. Get your host name.
  2. Put some files, like bear.jpg, abc.txt, into the same path as the src folder. Like, Multi-ThreadedWebServer\src Multi-ThreadedWebServer\bear.jpg Multi-ThreadedWebServer\abc.txt

Running

The server port is 1500. If your machine's name is Anthony, your server is listening to 1500, and you want to retrieve the file bear.jpg through browser, they you can specify the followiing URL in the browser: http://Anthony:1500/bear.jpg

You should not omit ":1500", otherwise you pc will be listening to the standard port 80 by default.

Also, favicon.ico denotes website icon or page icon. You may put a file name favicon with suffix .ico to see the result.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

This project aims at developing a socket program that implements a multi-threaded Web service using HTTP protocol, without using ServerSocket.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published