1. Home
  2. Computing & Technology
  3. Python

Building a Simple Web Server in Python

From Al Lukaszewski, for 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.

Explore Python
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

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

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

All rights reserved.