Re: Server push using PHP

From: Date: Tue, 26 Sep 2000 00:12:54 +0000
Subject: Re: Server push using PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-17449@lists.php.net to get a copy of this message
Time limit was my first guess too. You did set_time_limit(0)? I have done a similar thing at http://geekcam.hackor.com/ with multipart messages. Although, I store the pictures in a mysql table so that I can replace them easily and sort by date or whatever. Sidenote: through my research, Microsoft IE doesn't know how to display multipart messages. -jeremy brand _______________________________________________________________________ GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9 _ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more __ On Mon, 25 Sep 2000, Robert wrote: > Date: Mon, 25 Sep 2000 10:40:30 -0400 (EDT) > From: Robert <robert@abilina.org> > To: php-general@lists.php.net > Cc: Robert <robert@abilina.org> > Subject: [PHP] Server push using PHP > > I am working on a project that needs to use the "server push" mode. What > I need to do is send a series of jpg's to a client such that each new jpg > replaces the previous one. What the client sees is a low rep rate > "movie". The code I have at this point, nearly works. I can send a > series of images, however, the php script occasionally stops before it > sends the entire list of images. > > PHP's behavior is strange, because it's pretty consistant about which > images it stops on. If I remove the "offending image" from the list, the > script will continue with later images, until it hits another "offending > image". About 1 image in 125 is an offending image, and stops the script. > One other clue, is that the "offending image" is the one shown on the > browser when the transfer stops. In other words, "offending images" can > be displayed, but they prevent the script from proceeding to the next > image. > > At first I thought the problem was that PHP was timing out. However adding > set_time_limit() has made no difference, and besides the script stops > at a certain image, not after a certain number of images, or after a > certain amount of time. > > Then I suspected my browser was at fault, but I have also generated a perl > cgi script to do the server push function, and it runs thru the "offending > images" just fine. Is it possible that the php function readfile() has > trouble with transfering certain charactor codes? > > Any assistance would be greatly appreciated. Details are below. > > Best Regards, > Robert > > -------------------------------- > PHP script I am using to send the images: > > <?php > Header("Content-type: multipart/x-mixed-replace; boundry=--myboundryishere"); > > # parms passed in the URL: > # $dir the directory to read the image files from > # $min the index number of the first file to display > # $max the index file of the last file to display > # $rate the number of milliseconds between images > > $l = ls $dir; > $files = explode("\n", chop($l)); > $micro = 1000 * $rate; > set_time_limit( 3600 ); > > echo "--myboundryishere\n"; > while( list( $no, $line ) = each( $files )) { > if( ($no >= min) && ($no <= $max) ) { > echo "Content-type: image/jpeg\n\n"; > readfile("$dir/$line"); > echo "\n\n--myboundryishere\n"; > usleep($micro); > } > } > ?> > > > ---------------------------- > Here is the line used to invoke this script: > > echo "<img > src=\"scan_image.php?dir=$dir&min=0&max=20000&rate=250\">"; > > ----------------------------- > Here is the partial output from phpinfo() on this server: > > PHP Version 4.0.2 > > System Linux xxx.xxx.xxx 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST > 2000 i686 unknown > > Build Date Sep 23 2000 > > Configure Command './configure''--with-mysql' '--with-apxs' > '--enable-magic-quotes' > '--with-ndbm' > > Server API Apache > > Virtual Directory Support disabled > > Configuration File (php.ini) /usr/local/lib > Path > > ZEND_DEBUG disabled > > Thread Safety disabled > > ------------------- > > The OS was built from RedHat 6.2. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#17449) next »