cgi in win2000 have multi-user problem....

Discussion in 'Python' started by strong, Aug 7, 2003.

  1. strong

    strong Guest

    may you help me??
    thanks!!
    I want to establish a environment to server multi-user in win2000
    I run a cgi-multithread-server program,its name is cgisrv.py
    and I write two programs to test it, one is named as test.py,another is result.py
    test.py : it has a form and a submit button,submit to result.py, it's just a html page
    result.py : use time.sleep(10) to wait 10 seconds,show the time before it and after it
    IN WINDOW98 AND LINUX :a. I open single IE to conncet to the test.py and click the button ,it's correctly,
    I can see the correct message
    b.I open IE Browser 3 times TO connect to the test.py and click the button at the
    same time, 3 browsers all has the correct message
    IN WINDOW2000: a. I open single IE to conncet to the test.py and click the button ,it's correctly,
    I can see the correct message
    b. But when I open IE Browser 3 times TO connect to the test.py and click the button at the
    same time, the lastest clicked browser has correctly message, the first and second browser
    occur error
    anybody can resolve this problem ............
    please help me.....
    thank you~

    These are my 3 programs:

    -------------cgisrv.py----------------
    import SocketServer
    import BaseHTTPServer
    import MyCGIHandler
    import time
    class MyThreadingMixIn:
    def process_request_thread(self, request, client_address):
    try:
    self.finish_request(request, client_address)
    self.close_request(request)
    except:
    print "MyThread::Except"
    self.handle_error(request, client_address)
    self.close_request(request)
    def process_request(self, request, client_address):
    """Start a new thread to process the request."""
    import threading
    t = threading.Thread(target = self.process_request_thread,
    args = (request, client_address))
    t.start()
    class MyCGIServer(MyThreadingMixIn, BaseHTTPServer.HTTPServer):
    def close_request(self, request):
    print "Svr::close_req() >> [%s]\n" % time.asctime()
    import sys
    server = MyCGIServer(('', 80), MyCGIHandler.MyCGIHandler)
    try:
    while 1:
    sys.stdout.flush()
    print "Running.."
    server.handle_request()
    except KeyboardInterrupt:
    print "Finished"

    --------------------test.py-----------------
    import cgi
    print "Content-type: text/html"
    print
    print "<html><head><title></title>"
    print "</head>"
    print "<body>"
    print "<form name=form1 action=result.py>"
    print "<input type=submit value='start'>"
    print "</form>"
    print "</body></html>"

    -------------------result.py-----------------
    import cgi,time
    print "Content-type: text/html"
    print
    print "<html><head><title></title>"
    print "</head>"
    print "<body>"
    print time.localtime()
    print "<br>"
    time.sleep(10)
    print "<br>"
    print time.localtime()
    print "</body></html>"
    strong, Aug 7, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sanjay
    Replies:
    4
    Views:
    2,687
  2. Thomas Rivas

    Problem w/ IDLE on Win2000

    Thomas Rivas, Aug 6, 2003, in forum: Python
    Replies:
    2
    Views:
    260
    David Lees
    Aug 6, 2003
  3. Replies:
    1
    Views:
    339
    Jonathan Mcdougall
    Jun 4, 2006
  4. Richard Morey
    Replies:
    4
    Views:
    111
    James Monroe
    Aug 22, 2003
  5. Replies:
    2
    Views:
    117
    Ray Costanzo [MVP]
    Oct 18, 2005
Loading...

Share This Page