Skip to content

Latest commit

 

History

History
23 lines (11 loc) · 983 Bytes

README.md

File metadata and controls

23 lines (11 loc) · 983 Bytes

Build a simple HTTP sever with Java

How to make HTTP Server in Java

You can use ServerSocketclass in Java to create a Server which can accept requests.

Blocking Method

Blocking methods in Java are those methods which block the executing thread until their operation finished.

A famous example of blocking method is InputStream read() method which blocks until all data from InputStream has been read completely.

HTTP

This is the standard HTTP Server, its simple because HTTP is stateless, which means it doesn't need to remember previous connection, all it care for new incoming connections. This is endless cycle until server is stopped.

It's better to use BufferedReader because browser will send multiple line.

Resources

1.Java Network Programming, 4th Addition