Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EX01 Developing a Simple Webserver

Date:

24.10.2024

AIM:

To develop a simple webserver to serve html pages and display the configuration details of laptop.

DESIGN STEPS:

Step 1:

HTML content creation.

Step 2:

Design of webserver workflow.

Step 3:

Implementation using Python code.

Step 4:

Serving the HTML pages.

Step 5:

Testing the webserver.

PROGRAM:

from http.server import HTTPServer,BaseHTTPRequestHandler

content='''
<!doctype html>
<html>
    <title>LAPTOP</title>
    <body>
        LAPTOP CONFIGURATION
        <TABLE border="10" celpadding="15">
            <tr><th>SYSTEM CONFIGURATION</th> <th>DESCRIPTION</th></tr>
            <tr><td>Processor</td> <td> Intel core-i5</td></tr>
            <tr><td>Primary Memory</td> <td>16GB Ram</td></tr>
            <tr><td>Secondary Memory</td> <td>512GB ssd</td></tr>
            <tr><td>OS</td> <td>Windows 11</td></tr>
            <tr><td>Graphics Card</td> <td>NVIDIA GeForce MX550</td></tr>
        </TABLE>
    </body>
</html>

'''

class MyServer(BaseHTTPRequestHandler):
    def do_GET(self):
        print("Get request received...")
        self.send_response(200) 
        self.send_header("content-type", "text/html")       
        self.end_headers()
        self.wfile.write(content.encode())

print("This is my webserver") 
server_address =('',8000)
httpd = HTTPServer(server_address,MyServer)
httpd.serve_forever()

OUTPUT:

alt text

alt text

RESULT:

The program for implementing simple webserver is executed successfully.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages