Forum Moderators: coopster & phranque

Message Too Old, No Replies

realtime perl output using multipart/mixed

possible restrictions on shared apache host?

         

amznVibe

9:40 pm on Sep 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am unsuccessfully trying to accomplish "realtime" perl output to the browser.
No matter what I do, it always gets buffered and printed out in a rush at the end. :(

Even textbook examples are not working. Is it possible my apache based host is preventing this kind of output from working correctly?

the script seems simple enough, is this syntax correct?

#!/usr/bin/perl
$¦ = 1;

print "Content-type: multipart/mixed;boundary=\"boundary\"\n\n";
print "\n--boundary\n";
print "Content-type: text/html\n\n";

for ($x = 0; $x < 10; $x++)
{
print "Line $x<BR>\n";
sleep 1;
}

exit;

Should be showing one line a second, not all 10 lines dumped at once after 10 second (like its doing) :(

Thanks for any help!

amznVibe

3:02 am on Sep 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ah, aparently this kind of server push technology never matured because Microsoft never implimented it into IE... the information I had was from back in 1999 when Netscape was still hawking this concept... sigh, oh well...

(unless someone has a different approach to accomplish this from the server side?)

Storyteller

11:37 pm on Sep 11, 2003 (gmt 0)

10+ Year Member



You need to turn off output buffering:

$¦++;

If have a CGI script that outputs thousands of lines at about one per second, and it works like a charm.

moltar

11:49 pm on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It has nothing to do with IE. This works only on Linux/Unix servers. Even if you run apache under windows it will not work.

amznVibe

11:54 pm on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I meant that IE does not support server push technologies. Microsoft decided to follow the client pull concept. Netscape wanted server push, but we can see what happened in that battle.

There is no way to accomplish this universally even limiting to modern browsers, you must use client pull. I've given up and moved on.

(it has nothing to do with apache/perl buffering, HTML simple doesn't work with byte by byte data, it rendered the page based on the browser's own decision)

moltar

12:07 am on Sep 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The famous "Google Website Position Checker" uses real time perl output. I can sticky you with URL if you want.

cminblues

9:13 am on Sep 12, 2003 (gmt 0)

10+ Year Member



You can:

0] use a sniffer [ethereal i.ex.], so you can see if the client gets the line each second, or not.
Maybe you can increase the value of sleep, so it's easier to watch the ethereal logs.

1] try to delete your 2 boundary 'print' lines, leaving only the third, and see what happens.

I've made successfully something similar, working with all version of IE, even with images:
printed out by the browser slowly.. slowly..
[but, btw, I've never used multipart/mixed]