1. Home
  2. Computing & Technology
  3. Python

Building a Simple Web Server in Python

By Al Lukaszewski, About.com

7 of 10

Binding the Port to the Socket

After creating the socket and setting its options, we need to bind the port to the socket.

c.bind((host, port))

The binding done, we now tell the computer to wait and to listen on that port.

c.listen(1)

If we want to give feedback to the person who calls the server, we could now enter a print command to confirm that the server is up and running.

7 of 10

Explore Python

More from About.com

  1. Home
  2. Computing & Technology
  3. Python
  4. Networking
  5. Python Web Server: Binding the Port to the Socket

©2008 About.com, a part of The New York Times Company.

All rights reserved.