I need a HTTP server handling long lasting requests e.g. 10-30 seconds.
Below is a pice of the code. In order to make the server reponsive while
handling othere requests I use SocketServer.Th readingMixIn.
However the problem is the it does not work out. I checked thet a new
thread is created for each new connection new, but the main loop seems
to be frozen until the prevoius handling ends.
What could go wrong?
Thanks, Andy
* * *
import os
import time
import BaseHTTPServer
import SocketServer
import threading
import sys
class
SimpleHTTPReque stHandler(BaseH TTPServer.BaseH TTPRequestHandl er):
def do_GET(self):
response="aaaaa aaaaaaaaaaa"+st r(time.time())
self.send_respo nse(200)
self.send_heade r("Content-type",'text/plain')
self.send_heade r("Content-Length",len(res ponse))
self.end_header s()
time.sleep(10) #simulation of the processing
self.wfile.writ e(response)
def do_POST(self):
self.do_GET()
class
myWebServer(Soc ketServer.Threa dingMixIn,BaseH TTPServer.HTTPS erver):
pass
if __name__ == '__main__':
server_address = ('',80)
httpd=myWebServ er(server_addre ss,SimpleHTTPRe questHandler)
sa=httpd.socket .getsockname()
print "Serving HTTP on", sa[0], "port", sa[1],"..."
httpd.serve_for ever() 4 3317
Sorry for questioning Python :-) - it turned out that this is a problem
with Mozilla. For some reason it holds up with opening second connection
to given host until the previous one is completed. Interestingly enough,
IE works better with Python multi threaded server in that regard.
Thx, A.
Andy Leszczynski wrote: Sorry for questioning Python :-) - it turned out that this is a problem with Mozilla. For some reason it holds up with opening second connection to given host until the previous one is completed. Interestingly enough, IE works better with Python multi threaded server in that regard.
Thx, A.
Try switching keepalives off, or falling back to HTTP 1.0 - ironically
it may be the attempt to use the same connection for both pieces of
content that holds things up.
regards
Steve
--
Steve Holden +1 703 861 4237 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Steve Holden wrote: Andy Leszczynski wrote:
Sorry for questioning Python :-) - it turned out that this is a problem with Mozilla. For some reason it holds up with opening second connection to given host until the previous one is completed. Interestingly enough, IE works better with Python multi threaded server in that regard.
Thx, A.
Try switching keepalives off, or falling back to HTTP 1.0 - ironically it may be the attempt to use the same connection for both pieces of content that holds things up.
regards Steve
I tested it before and it did not work either. Have to try HTTP 1.0 thouh.
Thanks, A.
Steve Holden wrote: Andy Leszczynski wrote:
Sorry for questioning Python :-) - it turned out that this is a problem with Mozilla. For some reason it holds up with opening second connection to given host until the previous one is completed. Interestingly enough, IE works better with Python multi threaded server in that regard.
Thx, A.
Try switching keepalives off, or falling back to HTTP 1.0 - ironically it may be the attempt to use the same connection for both pieces of content that holds things up.
regards Steve
I tested it before and it did not work either. Have to try HTTP 1.0 thouh.
Thanks, A. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marian Horniak |
last post by:
hello to everyone,
please can you give me a link to example with request handling on IIS ver 5
and 6 ?
Main idea is : work with request from all clients complexly . (e.g. set
priority, canceling ...). If it's possible , for .NET languages .
thank you
regards
Maros
|
by: Steve M |
last post by:
Why are my sessions lasting so long?
I have them set to 20 minute timeout in config file?
The Session_End event is getting called an hour or more sometimes--well
after the user has stopped interacting with my site.
Anyone have any insight?
Thanks in advance
|
by: Ryan |
last post by:
I am hoping to get some ideas on how to handle a case when an
application gets too many requests for an application... I would like
to handle the case well...
(1) is the answer in using the queue limit attributes in the config
files and setting the too busy error page (in IIS i think) to nice
error page?
(2) is the answer to create a upfront request-handling application
that doesnt hit the database that counts requests for a certain...
|
by: Seth |
last post by:
Ok, here is my setup. I have a fully functioning HTTP Handler
implemented. The handler is supposed to handle every single request
that comes in to a particular virtual directory. Thus, in IIS, I have a
mapping of .* to the aspnet_isapi.dll. And my web.config has an entry
thusly:
<add verb="*" path="*" type="HandlerClass, HandlerAssembly" />
And this is working just fine thus far. The handler gets all the
requests and works like a...
|
by: Anthony England |
last post by:
I am considering general error handling routines and have written a sample
function to look up an ID in a table. The function returns True if it can
find the ID and create a recordset based on that ID, otherwise it returns
false.
**I am not looking for comments on the usefulness of this function - it is
only to demonstrate error handling**
There are three versions of this code. David Fenton says under the earlier
thread "DAO...
| |
by: ob |
last post by:
The situation I have is that I have a long running process (that takes 15 min
to process) kicked off from an ASP.NET page. I launch a thread and kick of
the process and return instantly. I store information about the thread in
the session variable, which allows the user to login later and see what the
status of that process is. I would like to use a web garden, however the
round robin assignment of requests to the worker processes...
|
by: lai_waiman |
last post by:
Dear All,
I have problems on doing some long lasting job in a web services.
Let me first provide some background information first.
I have a ASP.NET web page, which will call another Web Services to preform a
task. Since that Web Service Task last for a quiet long time (eg. 1 hr). If I
return the result after the long task, I am sure that the client browser will
be timeout. So I decided to use threading inside the Web Service. My...
|
by: =?Utf-8?B?QmFjaA==?= |
last post by:
Hi,
I have a ASP.NET 2.0 web service, which runs beautifully when hosted in the
development server of VS2005 (out side of IIS) but crashes when hosted inside
IIS 5.1 or IIS 6.0 when it takes several minutes to process a request. On
some server, it will consistently crash after 3 minutes, others can take up
to 30' or longer.
However, It can happily process shorter requests to the same web method.
When aspnet_wp crashes, it logs an...
|
by: Christoph Boget |
last post by:
I'm experiencing a very odd problem and it's happening only in IE6. IE7,
Safari, Opera and Firefox are all working properly. What's happening is
that I'm using XHR request responses to update the pages DOM, there appears
to be a conflict and/or race condition that pretty much locks the browser
down for several minutes until one of the requests times out. A huge red
flag stands out to me from the XHR object documentation...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |