You are here:About>Computing & Technology>Python> Networking> Python Web Server: Building a Simple Web Server in Python
About.comPython
Newsletters & RSSEmail to a friendSubmit to Digg

Building a Simple Web Server in Python

From Al Lukaszewski,
Your Guide to Python.
FREE Newsletter. Sign Up Now!

Introduction to socket

As a complement to the network client tutorial, this tutorial shows how to implement a simple web server in Python. To be sure, this is no substitute for Apache or Zope. There are also more robust ways to implement web services in Python, using modules like BaseHTTPServer. This server uses the socket module exclusively.

You will recall that the socket module is the backbone of most Python web service modules. As with the simple network client, building a server with it illustrates the basics of web services in Python transparently. BaseHTTPServer itself imports the socket module to affect a server.

  1. Introduction to socket
  2. Running Servers
  3. Communicating Via Sockets
  4. Hosts and Ports
  5. Creating a Socket
  6. Setting Socket Options
  7. Binding the Port to the Socket
  8. Handling a Server Request
  9. Sending Data to the Client
  10. Final Analysis and Shutting Down

Previous | Next >>

 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.