1. Home
  2. Computing & Technology
  3. Python

Building a Simple Web Server in Python

From , former About.com Guide

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

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. 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.