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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • just.starting@gmail.com

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

    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.

  • Mladen Gogala

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

    On Wed, 04 Jan 2006 05:49:37 -0800, just.starting@g mail.com wrote:
    [color=blue]
    > 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.[/color]

    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) ?

    --


    Comment

    • just.starting@gmail.com

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

      I am specifying the name to the dowload.php.

      Here is the code:

      function readfile_chunke d($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.

      Comment

      • just.starting@gmail.com

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

        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.

        Comment

        Working...