PostHeaderIcon python 2.7 small http server

just code here:

import SimpleHTTPServer
import SocketServer
import sys

PORT = 8000

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
try:
    httpd = SocketServer.TCPServer(("", PORT), Handler)

    print "serving at port", PORT
    httpd.serve_forever()
except KeyboardInterrupt:
    httpd.server_close()
    print 'user exit program...'
    sys.exit()

enjoy~

1802 views

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Copyright © 2010 - C++ Technology. All Rights Reserved.

Powered by Jerry | Free Space Provided by connove.com