<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=big5">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>may you help me??</FONT></DIV>
<DIV><FONT face=Arial size=2>thanks!!</FONT></DIV>
<DIV><FONT face=Arial size=2>I want to establish a environment to server
multi-user in win2000</FONT></DIV>
<DIV><FONT face=Arial size=2>I run a cgi-multithread-server program,its name is
cgisrv.py</FONT></DIV>
<DIV><FONT face=Arial size=2>and I write two programs to test it, one is named
as test.py,another is result.py</FONT></DIV>
<DIV><FONT face=Arial size=2>test.py : it has a form and a submit
button,submit to result.py, it's just a html page</FONT></DIV>
<DIV><FONT face=Arial size=2>result.py : use time.sleep(10) to wait 10
seconds,show the time before it and after it</FONT></DIV>
<DIV><FONT face=Arial size=2>IN WINDOW98 AND LINUX :a. I open single IE to
conncet to the test.py and click the button ,it's
correctly,</FONT></DIV>
<DIV><FONT face=Arial
size=2>
I can see the correct message</FONT></DIV>
<DIV><FONT face=Arial
size=2>
b.I open IE Browser 3 times TO connect to the test.py and
click the button at the</FONT></DIV>
<DIV><FONT face=Arial
size=2>
same time, 3 browsers </FONT><FONT face=Arial size=2>all has the
correct message</FONT></DIV>
<DIV><FONT face=Arial size=2>IN WINDOW2000: a. I open single IE to conncet to
the test.py and click the button ,it's correctly,
<DIV><FONT face=Arial
size=2>
I can see the correct message</FONT></DIV>
<DIV>
b. But when I open IE Browser 3 times TO connect to the test.py and click the
button at the </DIV>
<DIV> same
time, the lastest clicked browser has correctly message, the first and
second browser</DIV>
<DIV>
occur error </DIV>
<DIV>anybody can resolve this problem ............</DIV>
<DIV>please help me.....</DIV>
<DIV>thank you~</DIV>
<DIV> </DIV>
<DIV>These are my 3 programs:</DIV>
<DIV></FONT> </DIV></DIV>
<DIV><FONT face=Arial size=2>-------------cgisrv.py----------------</FONT></DIV>
<DIV><FONT face=Arial size=2>import SocketServer<BR>import
BaseHTTPServer<BR>import MyCGIHandler<BR>import time</FONT></DIV>
<DIV><FONT face=Arial size=2>class MyThreadingMixIn:<BR> def
process_request_thread(self, request,
client_address):<BR>
try:<BR>
self.finish_request(request,
client_address)<BR>
self.close_request(request)<BR>
except:<BR>
print
"MyThread::Except"<BR>
self.handle_error(request,
client_address)<BR>
self.close_request(request)</FONT></DIV>
<DIV><FONT face=Arial size=2> def process_request(self,
request, client_address):<BR> """Start
a new thread to process the
request."""<BR> import
threading<BR> t =
threading.Thread(target =
self.process_request_thread,<BR>
args = (request, client_address))<BR>
t.start()</FONT></DIV>
<DIV><FONT face=Arial size=2>class MyCGIServer(MyThreadingMixIn,
BaseHTTPServer.HTTPServer):<BR> def close_request(self,
request):<BR> print "Svr::close_req()
>> [%s]\n" % time.asctime()</FONT></DIV>
<DIV><FONT face=Arial size=2>import sys</FONT></DIV>
<DIV><FONT face=Arial size=2>server = MyCGIServer(('', 80),
MyCGIHandler.MyCGIHandler)</FONT></DIV>
<DIV><FONT face=Arial size=2>try:<BR> while
1:<BR>
sys.stdout.flush()<BR> print
"Running.."<BR>
server.handle_request()<BR>except KeyboardInterrupt:<BR> print
"Finished"</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>--------------------test.py-----------------</FONT></DIV>
<DIV><FONT face=Arial size=2>import cgi<BR>print "Content-type:
text/html"<BR>print <BR>print
"<html><head><title></title>"<BR>print
"</head>"<BR>print "<body>"<BR>print "<form name=form1
action=result.py>"<BR>print "<input type=submit
value='start'>"<BR>print "</form>"<BR>print
"</body></html>"</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>-------------------result.py-----------------</FONT></DIV>
<DIV><FONT face=Arial size=2>import cgi,time<BR>print "Content-type:
text/html"<BR>print <BR>print
"<html><head><title></title>"<BR>print
"</head>"<BR>print "<body>"<BR>print time.localtime()<BR>print
"<br>"<BR>time.sleep(10)<BR>print "<br>"<BR>print
time.localtime()<BR>print
"</body></html>"</FONT></DIV></BODY></HTML>