FAQ
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>"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-list/attachments/20030807/c2646bb7/attachment.html

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedAug 7, '03 at 9:42a
activeAug 7, '03 at 9:42a
posts1
users1
websitepython.org

1 user in discussion

Strong: 1 post

People

Translate

site design / logo © 2022 Grokbase