By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,895 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

Having connection timeout problem when calling a php script while downloading a file from the same server.

P: n/a
Hi,
My dot net client downloads files and checks for any new files time to
time. The server is apache2.0.53 server. So what happens is that my
file download thing works fine if I dont try to call any page from the
server while downloading. If I try to call a single page while
downloading a file then the page request goes time out and the server
then closes the existing download stream and the client doestn't throw
any exception. So many a time I end up with incomplete downloaded file.
The server side code is in PHP and every thing like calling a page or
downloading a file is done by calling some PHP script.

What is the reason behind this type of behaviour.Has this anything to
do with PHP and server settings.
Thanx.

Jan 4 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Wed, 04 Jan 2006 05:49:37 -0800, ju***********@gmail.com wrote:
My dot net client downloads files and checks for any new files time to
time. The server is apache2.0.53 server. So what happens is that my
file download thing works fine if I dont try to call any page from the
server while downloading.


How do you "call page while downloading"? Are you trying to open another
page in the same window? Have you tried disabling timeout (careful with
that!!!) in your script by using something like: set_time_limit(0) ?

--
http://www.mgogala.com

Jan 4 '06 #2

P: n/a
I am specifying the name to the dowload.php.

Here is the code:

function readfile_chunked($filename)
{
$chunksize = 256*1024; // how many bytes per chunk
$buffer = '';
$handle = fopen($filename, 'rb');
if ($handle === false) {
return false;
}
fseek($handle,0);
while (!feof($handle)) {
set_time_limit(0);
$buffer = fread($handle, $chunksize);
print $buffer;
sleep(1);
}
return fclose($handle);
}

When ever I call any other single page then it seems to wait for the
download stuff to complete, and eventually timed out if the download
thing takes long time.

Jan 6 '06 #3

P: n/a
Ahhhhhhhhhhh....
There is another problem. I have kept some files at the server for
testing purpose. There is one particular file arnd 3KB in size. I can
download other files fine(in case I dont access any other page in
between). But in case of that particular file the client disconnects
saying Unable to read data from transport connection. That means the
connection is being closed arbitrarily. But downloading other files
just works fine.
Need some help here.
Thanks.

Jan 6 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.