W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2000

showing nbr bytes received so far

From: Philip Stuyck <philip.stuyck@alcatel.be>
Date: Wed, 20 Sep 2000 08:13:47 +0200
Message-ID: <39C8559B.A30EDC7F@alcatel.be>
To: www-lib@w3.org

I am trying to make a progress indicator that shows the number of bytes
received so far in a progress dialog. It is unknown what the size will
be in
advance because it is the result of a cgi. The code below tries to get
the total size, but that is not the point I am trying to make.
When I use the HTRequest_bodyRead(request); function in a progress
handler function it does not return anything (yeah 0).
When I use the HTRequest_bytesRead(request);function in a progress
handler function it does return something but not the correct values (I
Some cgi's produce a rather big output which take a while to receive at
client. It would be nice to show something moving at the client, like
number of bytes received.

I also develop in Delphi, and there is a HTTP component that tells you
amount of bytes received so far.in a PacketReceived event handler
So at least I think it should be possible to do it. And this strikes me
as very
similar as the progress handler in libwww.

But probably I am doing something wrong. Do I have to register something
Also the msgnum and defaultmessage in the progress handler function do
contain anything which I think is very strange. ???? (I saw this during
PRIVATE int webprogress_handler(HTRequest* request, HTAlertOpcode op,int
msgnum,const char* defaultmessage, void* input,HTAlertPar* reply){}

This chunk of code I am using :
   long cl = HTAnchor_length(HTRequest_anchor(request));
   cl = 1; //just to trick the if into true
   if (cl > 0) {
        long b_read = HTRequest_bodyRead(request);
              double pro = (double) b_read/cl*1/*00 do not see why it
should be in kbytes*/;
              char buf[10];
     char sbuf[10];
              HTNumToStr((unsigned long) cl, buf, 10);
              char message[255]="read ";
     strcat(message," of ");

   } else

thanks in advance
Philip Stuyck

Received on Wednesday, 20 September 2000 02:14:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:53 UTC