Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Out of memory error using wwIPStuff on large files
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00461693
Message ID:
00463254
Vues:
18

>Well, tcBuffer is .F. because the assignment fails at some point and
>it reverts to its default value. So that's to be expected.

>The other thing is to break down the files into smaller chunks to send. >Honestly I wouldn't send more than a couple of megs over HTTP in general.


Rick,
Thanks for writing back... I guess nothing's perfect, and I'll have to make do... But I might only be willing to pay $98.99 for wwIPStuff now... *grin*
I think I'm going to split the files up into 1 MB chunks before sending them, and any files to be saved larger than 1 MB will be saved to the disk 1 MB at a time... Since I'm never going to be passing a filename to httpgetex(), I might just leave the line that builds tcBuffer commented out. We're all for cheap hacks around here.

As for sending data over HTTP... We'd use FTP, but my boss is afraid someone might grab the plaintext username/password and then the file as it's going down the wire and get a free copy of our software... So I have to use HTTP with FoxISAPI to authenticate the user over HTTPS, then give them a cookie and switch to HTTP to send them the file with ASP (in a hurry, before the cookie expires). It's a tad messy, but it's the best solution I could come up with. Any better suggestions are always welcome. (I'd rather not authenticate and create temporary accounts that would only allow one user to be on them at a time... ick.)


>>I downloaded wwIPStuff a few days ago to use in one of our applications for downloading automatic updates to our software. I was originally using MS's Internet Transfer Control, but it lacked a way to update a progress bar (not a good thing when getting >20 mb files over a modem).
>>
>>I'm using httpgetex() with the wwIPStuff class control on my form. Everything appears to work fine except for large files. I was taking each lcCurrentChunk in onhttpbufferupdate() and storing it to a new element in an array. When httpgetex() returned, my code added the array elements together and spit out the binary file.
>>
>>This worked fine until I tried getting a 7 mb file. I got an 'out of memory' error from FoxPro around 5,074,944 bytes. I just stopped program execution, figuring the large array was the problem. I changed the array operations to just do a StrToFile() with append set to True after getting each chunk. This also worked fine, until I tried that 7 mb file again. This time I suspended the program and saw the out of memory error was occurring in httpgetex() in the wwIPStuff class. The error is occurring on this line:
>>
>>
>>tcBuffer = tcBuffer + LEFT(lcReadBuffer,lnBytesRead)
>>

>>
>>My boss and I did some casual browsing and noticed tcBuffer=.F. LEN(lcReadBuffer) and lnBytesRead both =4096. Because of the tcBuffer=.F., our attempt to RESUME resulted in an operator/operand type mismatch.
>>
>>Here's my childishly simple onhttpbufferupdate() in case you're interested. It's right from the example that comes with the class:
>>
>>
>>LPARAMETERS lnbytesdownloaded,lnbufferreads,lccurrentchunk
>>
>>DO CASE
>> CASE lnBufferReads = 0 && First Read is the HTTP Header
>> =messagebox(lcCurrentChunk,"Header for: "+alltrim(THISFORM.txtUrl.Value)+alltrim(thisform.txtDir.value)+"/"+alltrim(thisform.txtFilename.value))
>> DoEvents
>> CASE lnBufferReads = -1 && Download is complete
>> thisform.caption="Download Complete."
>> OTHERWISE
>> DoEvents
>> THISFORM.caption="Downloading... "+STR(lnBytesDownloaded) + " bytes recieved."
>> StrToFile(m.lcCurrentChunk,ThisForm.SaveFileAs,.t.)
>>
>>ENDCASE
>>

>>
>>We're not sure exactly what's going on, or why that little line would run us out of memory. Could you please help us out? Thanks.
Nick Stenz,
Junior Developer/VFP hacker
nstenz@kdsmoses.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform