Skip to content

Latest commit

History

History
72 lines (45 loc) 路 1.13 KB

File metadata and controls

72 lines (45 loc) 路 1.13 KB

Java Web Server

A simple HTTP server built using Java's ServerSocket and Socket classes. It listens on port 8080 and responds with a basic HTML page showing the current server time.


How It Works

  1. Creates a ServerSocket on port 8080.
  2. Waits for a client (browser) to connect.
  3. Accepts the connection.
  4. Sends an HTTP response containing HTML.

Sample Output

Console

馃殌 Server started at http://localhost:8080

Browser

Server Icon

Technologies Used

  • Java
  • ServerSocket
  • Socket
  • OutputStream
  • HTTP

How to Run

  1. Compile the program.
javac WebServer.java
  1. Run the server.
java WebServer
  1. Open your browser and visit:
http://localhost:8080