title: A simple python server using SimpleHTTPServer and SocketServer, how do I close the socket down before rerunning .py file?
body: <p>When I run my python server file <code>simplehttpwebsite.py</code> in the linux shell and I do control+c and run it again I get <code>socket.error: [Errno 98] Address already in use</code>. </p>
  
  <p>How do I  make sure the socket closes down when I do ctrl+c?</p>
  
  <p><em>simplehttpwebsite.py</em></p>
  
  <pre><code>#!/usr/bin/env python
  import SimpleHTTPServer
  import SocketServer
  
  Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
  server = SocketServer.TCPServer(('0.0.0.0', 8080), Handler)
  
  server.serve_forever()
  </code></pre>