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

S

strong

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>"
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top