|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Zipping and streaming directory structure to client without temp filesHi
I need to zip and send a bunch of files (2 Gb) in a directory structure to a Web clinet. Using XCeed I've been able to zip the directory structure into a temporary file and the send it to the client. However it takes quite some time to zip the files, so sometimes the client timesout evenbefore the temp file is done. Is there a way to Zip and Send at the same time? Would it be possible to write and read from a memorystrream at the same time (using two different threads) TIA Søren yes. you can use the gzip class in .net to do this. But you do it stream by
stream, not zip all files together into one. I assume this would not be an issue as long as all files are compressed so you still get the desired effect. You can wrap each file stream in a gzip stream to read compressed bytes, and send that block to the socket, then do reverse. -- Show quoteWilliam Stacey [MVP] "Søren M. Olesen" <smole***@hotmail.com> wrote in message news:%23hPTqX$zFHA.1640@TK2MSFTNGP12.phx.gbl... > Hi > > I need to zip and send a bunch of files (2 Gb) in a directory structure to > a Web clinet. Using XCeed I've been able to zip the directory structure > into a temporary file and the send it to the client. However it takes > quite some time to zip the files, so sometimes the client timesout > evenbefore the temp file is done. Is there a way to Zip and Send at the > same time? Would it be possible to write and read from a memorystrream at > the same time (using two different threads) > > TIA > > Søren > > > > Hi William
Unfortunately I need to receive the file on the client as they were sipped together in one zip file with directory structure and all...... I don't really know how ZIP works, but if it just writes to a file without seeking it, I guess I can start reading it before it's completely written. However I won't know the exact size of the file when I start sending it to the client, so how do I setup the Content-Length?? can I just set it to something large, and then just flusg the Response object?? TIA Søren Show quote "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message news:ePdJfq$zFHA.560@TK2MSFTNGP12.phx.gbl... > yes. you can use the gzip class in .net to do this. But you do it stream > by stream, not zip all files together into one. I assume this would not > be an issue as long as all files are compressed so you still get the > desired effect. You can wrap each file stream in a gzip stream to read > compressed bytes, and send that block to the socket, then do reverse. > > -- > William Stacey [MVP] > > "Søren M. Olesen" <smole***@hotmail.com> wrote in message > news:%23hPTqX$zFHA.1640@TK2MSFTNGP12.phx.gbl... >> Hi >> >> I need to zip and send a bunch of files (2 Gb) in a directory structure >> to a Web clinet. Using XCeed I've been able to zip the directory >> structure into a temporary file and the send it to the client. However it >> takes quite some time to zip the files, so sometimes the client timesout >> evenbefore the temp file is done. Is there a way to Zip and Send at the >> same time? Would it be possible to write and read from a memorystrream at >> the same time (using two different threads) >> >> TIA >> >> Søren >> >> >> >> > > |
|||||||||||||||||||||||