[Tutor] Re: Unsure why won't work

Lloyd Kvam pythontutor@venix.com
Fri Aug 1 12:33:02 2003


A "normal cgi" script called from a web server will not be
able to hold the file open while sending results.  The web server
sends the results to the browser after the cgi script has completed.

Mike Hansen wrote:

>  >Date: Thu, 31 Jul 2003 13:02:53 -0700
>  >From: "Jeff Shannon" <jeff@ccvcorp.com>
>  >To: ebernert@crpud.net, python-tutor <tutor@python.org>
>  >Subject: Re: [Tutor] Unsure why won't work
> 
> [...]
> 
>  >Also, due to the limitations of
>  >HTTP, it's difficult to write a constantly-updating program -- the
>  >protocol works on a file-based basis.  A web browser requests a file,
>  >and typically cannot (properly) display the file until the entire
>  >contents have arrived.  Since this program is continually sending new
>  >output, you never send an entire "file" ... so even if a browser is able
>  >to show a response, you'll have a single page which is constantly
>  >growing, which is probably not the preferred way of doing this.  You
>  >could perhaps have the program write a single-page snapshot of the file
>  >and include a meta-refresh tag, which would tell the browser to reload
>  >the file (thus grabbing a new snapshot) after a few seconds.
> 
> It is possible and not that difficult to write a constantly updating web 
> page. A friend of mine works at an ISP. He has written Perl scripts that 
> display log files to web pages that are constantly updating. i.e. new 
> entries to the log file appear at the bottom of the page as they are 
> being written to the log file. I believe the trick is to not close the 
> file you are reading while you are pumping out it's contents to a web 
> page. The web page looks like it's not finished loading. It will never 
> be. I would need to look at the scripts to get more details.
> 
> I would think you would not want to perform this trick with more than 
> one connection to the web server. It's probably fine for sys admin type 
> tasks, but not for multi-user stuff.
> 
> Now, there's an issue with displaying HTML tables. In Microsoft Internet 
> Explorer, it won't display a table until the entire table is received. 
> Large tables take their sweet time displaying in MS IE.
> 
> Mike
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-443-6155
fax:	801-459-9582