项目作者: RobertoCarlosMedina

项目描述 :
Web server simulation.
高级语言: Python
项目地址: git://github.com/RobertoCarlosMedina/web-server-simulation.git


web-serve-semulation

This is a simple project simulation of a real Web Server,
Where it is possible to do multiple web request to a local server.

Main objective

The main objective is to simulate, more efficiently,
the functionality of a web server.

Dependences/libraries use:

The libraries that i use are the following one’s:

  1. import socket
  2. import request
  3. import Thread

Running & Debugging

The Web Server

To debug/run the web server, follow the steps:

1º - run the server script.

  1. python3 webserver.py

The output will be like this:

  1. Port 3000: trying to connect.
  2. Port 3000: already connected.
  3. The server is under state active.

2º - Go to the browser and access the sites that are available in the server.

Examples:

  1. - [http://localhost:3000/Facebook.html]()
  2. - [http://localhost:3000/Google.html]()
  3. - [http://localhost:3000/ArqRedes.html]()

The Client

To connect the server as a client, you have to run the client script:

  1. python3 client.py

the output will be a terminal where is possible to execute two commands.

The commands

  • To display the response code use:
    1. TCP/Server -> localhost 3000 -h ArqRedes.html
  • To display the contents of the html file:
    1. TCP/Server -> localhost 3000 -t ArqRedes.html