title: Python Server Client program error: "OSError: [WinError 10048]"
body: <p>So I'm studying Python from the book Fundamentals of Python by Kenneth Lambert and I'm having trouble with an error from one of the programs in the book.</p>
  
  <p>Here in chapter 10 talks about Clients and Servers. My professor asked us to key those programs in Python to see how they work. The first programs worked perfectly, but in a program I'm getting an error which seems to be a Windows error instead of a Python one. </p>
  
  <p>This is the program in page 339:</p>
  
  <pre><code>from socket import *
  from time import ctime
  from threading import Thread
  
  class ClientHandler(Thread):
      """Handles a client request."""
      def __init__(self, client):
          Thread.__init__(self)
          self._client = client
  
      def run(self):
          self._client.send(bytes(ctime() + '\nHave a nice day!' , 'ascii'))
          self._client.close()
  
  HOST = "localhost"
  PORT = 5000
  BUFSIZE = 1024
  ADDRESS = (HOST, PORT)
  
  server = socket(AF_INET, SOCK_STREAM)
  server.bind(ADDRESS)
  server.listen(5)
  
  # The server now just waits for connections from clients
  # and hands sockets off to client handlers
  while True:
      print('Waiting for connection')
      client, address = server.accept()
      print('...connected from:', address)
      handler = ClientHandler(client)
      handler.start()
  </code></pre>
  
  <p>When I run this program, it displays the "Waiting for connection" message in the Shell. However, when I try to connect to the program using the Command Prompt, it displays the following error:</p>
  
  <pre><code>C:\Python33&gt;python multi-client-server.py
  Traceback (most recent call last):
    File "multi-client-server.py", line 30, in &lt;module&gt;
      server.bind(ADDRESS)
  OSError: [WinError 10048] Only one usage of each socket address (protocol/networ
  k address/port) is normally permitted
  </code></pre>
  
  <p>We haven't studied this in class a lot. So I'm just wondering why this happens and how to fix it.</p>
  
  <p>Thanks!</p>