Re: more events pending....
| From: | firepages.com.au | Date: | Fri, 24 May 2002 05:00:30 +0000 |
| Subject: | Re: more events pending.... | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2045@lists.php.net to get a copy of this message | ||
bugger ;)
pcntl is not I think yet implemented in win32?? - you did however kickstart
me into just creating a seperate process by simply starting another PHP-GTK
app which handles the ftp_fget() bit and the original window can still get
the current status of the download by checking the filesize of the file
being downloaded and thus create some idea of status.
I suppose another option is to fsockopen() the remote file which I can read
$x bytes at a time which would allow me to add a call to the status update
display functions within that loop (no such posibilities with FTP functions
it appears to be an all or nothing affair).
The first option is easier, its just messy passing filename arguments to the
new app though I can just tack them on the end of the command line.
Cheers for all the replies, knowing that something is not realistically
possible is good ! it lets me concentrate on other methods to achieving the
same goal & save wasting time on a no-hoper.
Regards,
Simon Wheeler
firepages.
----- Original Message -----
From: <rdp@talisman.mv.com>
To: "firepages.com.au" <fire@firepages.com.au>
Cc: <php-gtk-general@lists.php.net>
Sent: Friday, May 24, 2002 3:20 AM
Subject: Re: [PHP-GTK] more events pending....
>
> Oh, OK, so it sounds like we're not doing anything until fget returns. I
> don't think there's much you can do about that. We still only have one
> thread available so you're app will still appear to stop on calls that
> take a long time. I have the same problem in teak for a few imap calls
> that can take a LONG time to return, timers stop and everything blocks
> until it returns. The only solution I can see so far is to use pcntl and
> fork off a seperate process (in your case to actually peform the
> download).
>
> --rdp
>
>
> On Fri, 24 May 2002, firepages.com.au wrote:
>
> > Hi, the start_ticker() && get_bytes() functions work fine.(I got them
from
> > this list) i.e. if I remove the call to fget(etc) which starts the ftp
> > download then they work fine and echo the (now static) filesize of the
file
> > once per second as required, but as soon as the call to fget(etc is made
and
> > the ftp download begins then the app pretty much freezes until the
download
> > is complete.
> >
> > I tried the events_pending in the ftp class itself, and that got me one
more
> > loop of the get_bytes() but only one.
> >
> >
> > Regards
> > Simon Wheeler
> > firepages.
> >
> >
> > ----- Original Message -----
> > From: "Rich Payne" <rdp@talisman.mv.com>
> > To: "firepages.com.au" <fire@firepages.com.au>
> > Cc: <php-gtk-general@lists.php.net>
> > Sent: Friday, May 24, 2002 2:45 AM
> > Subject: Re: [PHP-GTK] more events pending....
> >
> >
> > >
> > >
> > > I don't know about adding a timeout that calls the same function it
was
> > > started from. Don't know if that's allowed. Wouldn't it be easier just
to
> > > call start_ticker from a Gtk::timeout_add out side of the function and
> > > just return true ?
> > >
> > > --rdp
> > >
> > >
> > > On Fri, 24 May 2002, firepages.com.au wrote:
> > >
> > > > Hi yet again !
> > > >
> > > > imagine a script which downloads a file via FTP... , I am
> > ftp_fget()'ting
> > > > the file so I can check the progress of the download simply by
checking
> > the
> > > > filesize of the file downloaded so far, this all works I can 'see'
the
> > file
> > > > growing, I can check the filesize, but not in a loop?
> > > >
> > > > I want to be able to report (via status bar or whatever) the
progress of
> > the
> > > > download so I hoped that the loop in start_ticker() & get_bytes()
(which
> > > > worked fine as a clock) would allow me to update something or other,
> > however
> > > > whilst the start_ticker() runs once and reports the initial filesize
> > then
> > > > nothing else happens until the download completes , I have tried
> > > > event_pending in all sorts of weird and wonderful places, with so
far
> > little
> > > > joy, any pointers greatly appreciated.
> > > >
> > > > function
> > > >
> >
(){
> > > > $this=@filesize('c:/gtkdev/gtkdev.zip');
> > > > echo $this."bytes \n";
> > > > }
> > > > function start_ticker(){
> > > > get_bytes();
> > > > Gtk::timeout_add(1000, 'start_ticker');
> > > > }
> > > >
> > > > / /there is a window and stuff here//
> > > >
> > > > /* this fires up the ftp class & returns the filesize of the file I want to
> > > > download*/
> > > > $f=new ftp('www.firepages.org', '', '');
> > > > $thissize = $f->size('public_html/public/gtkdev.zip');
> > > >
> > > > /*hopefully start the loop that echos the current download -
> > > > I have tried this before and after the events_pending*/
> > > > start_ticker();
> > > >
> > > > while (gtk::events_pending())
> > > > gtk::main_iteration();
> > > >
> > > > /*start downloading the file*/
> > > > $f->fget('public_html/public/gtkdev.zip',
> > > > 'c:/gtkdev/gtkdev.zip');
> > > > /*when we have the file destroy the ftp object & connection*/
> > > > $f->nuke();
> > > >
> > > > gtk::main();
> > > >
> > > >
> > > >
> > > > Regards,
> > > > Simon Wheeler.
> > > > firepages
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > > --
> > > Rich Payne
> > > http://talisman.mv.com
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
>
> --
> Rich Payne
> http://talisman.mv.com
>
>
>
>