I have a progress bar that monitors transfer progress. it works fine with files up to 1.9GB but for files over 2GB the progress bar does not work. the file transfer but no progress appears on the bar. Has anyone experienced this?
thanks!
I have a progress bar that monitors transfer progress. it works fine with files up to 1.9GB but for files over 2GB the progress bar does not work. the file transfer but no progress appears on the bar. Has anyone experienced this?
thanks!
Mac, Windows or Linux? Which version of Xojo?
How do you calculate the max value of the progress bar? Can you show us some code?
Mac version of Xojo
The following code is placed in the ReceiveProgress event handler
if totalBytes = 0 then
ProgressBar1.Maximum = 0
else
ProgressBar1.Maximum =100
ProgressBar1.Value = (bytesReceived/totalBytes)*100
end
If that is in a 32 bit application it may me that bytesReceived, even is int64, i understand that in 32 bits is a int32 http://documentation.xojo.com/index.php/Int64 and the limit is -2,147,483,648 to 2,147,483,647 that is 2Gb, where it fails to you.
If this is the problem, then in 64 bit build must work.
Thanks Jose!!!
[quote=233901:@Kareem D]Mac version of Xojo
The following code is placed in the ReceiveProgress event handler
if totalBytes = 0 then
ProgressBar1.Maximum = 0
else
ProgressBar1.Maximum =100
ProgressBar1.Value = (bytesReceived/totalBytes)*100
end
[/quote]
What are the types of your bytesReceived and totalBytes variables?
[quote]HTTPSecureSocket.ReceiveProgress ( BytesReceived as Integer, TotalBytes as Integer, NewData as String )
The parameters provide the current number of bytes received and the total number of bytes (if available).
ReceiveProgress executes periodically during the download process.[/quote]
Integer will be 32bit in a 32bit build, and 64 bits in the 64 bit build
You cant report on the progress of files greater than 2gb in this way.
PERHAPS the values go negative when the 2gb limit is exceeded? (needs testing)
If so, you might be able to spot that and keep going for nearly 4Gb with some sneaky maths…?
Actually, if you use value types of UInt64, you can do 64bit match in a 32bit app. That’s why I asked what his types were for those two variables.
// dimensioned elsewhere - Dim totalBytes, bytesReceived As UInt64
if totalBytes = 0 then
ProgressBar1.Maximum = 0
else
ProgressBar1.Maximum =100
ProgressBar1.Value = (bytesReceived/totalBytes)*100
end
I dont think theres a choice. These variables are parameters…
I guess I’m missing something. Is there some locked down code being used to manage the transfer?
The problem is the totalBytes. According to http://documentation.xojo.com/index.php/HTTPSocket.ReceiveProgress this is an integer. So most likely it’s 32bit.
Have you tried the new framework’s HttpSocket? See http://developer.xojo.com/xojo-net-httpsocket$ReceiveProgress . There the parameters are 64bit.
You have to wonder why that wasn’t changed to Int64 a long while ago it certainly should be changed in the old framework.
Please switch to use percent or per mille to show the progress bar.
Also it is worth to only update progress bar once a second or every 1% step, so the drawing of progress bar doesn’t slow down the app.
Xojo.Net.HttpSocket uses Int64 for BytesReceived and TotalBytes.
Never thought I’d say this to you but: you are missing the point.
He IS using percent, but the INTEGER value of the parameter BytesReceived of HTTPSecureSocket.ReceiveProgress has an integer overflow for files larger than 2 GB. Not much he can do about that. I’d consider it an unwanted limitation of HTTPSecureSocket.ReceiveProgress that should be fixed.
Has already been said too. Is anybody actually reading the thread before replying?
And yes, I’m in a crabby mood
Sorry. It would not have hurt Xojo Inc. to make the progress parameters Int64 in the old HTTPSocket.
I think we are ALL guilty of that from time to time. For me personally, I will take the volume of quality, helpful replies Michel provides any day of the week over worrying about him going through his reply repeatedly to make sure the response is completely in line with the question or thread posed.
Well, “Somebody” - and I’m not mentioning any names - ate my chocolate Santa.
So I’m still in a crabby mood
[and I’m well aware it should be pp instead of bb but that would be swearing which is against forum policy]
Maybe this will cheer you up, your xDev contributions are thing I look forward to the most, every other month.
What’s new ?
Sorry for repeating.