|Perl Monk, Perl Meditation|
Re: Re: Re: Connection: Keep-Alive and Perlby shotgunefx (Parson)
|on May 30, 2001 at 01:31 UTC||Need Help??|
Keep-Alive in my understanding is really for keeping the server listening to the connection for a time after the initial transaction (So it doesn't have to spawn a new server for the next connection. Say if it's downloading a bunch of images from a web page.)
For keeping the browser around a long time I find that you have to keep talking to it. I have a database converter for a client that can take upwards of 30 minutes to run. What I do to keep the connection alive is by disabling buffering and before the long process I output a message like
"Processing please wait...
(This will take approximently 30 minutes. Go get a cup of coffee.)
Then as I process the data, I print a "." or something after every couple of hundred records (like sftp) so they know it is still going (and hopefully they don't get impatient and hit refresh as the process is HUGE and I don't want to start another one for no reason.)
There is probably a lot of ways to accomplish this. If you are forking I would do something similar and have the parent use sleep to time the printing. Keep in mind this solution is a bad idea if you expect a lot of people to be using these programs as your tying up a lot of resources. For my problem it's fine as only one person runs said program once a day.
"To be civilized is to deny one's nature."