dcsimg
How can I send large files to a HTTP Server using the HttpURLConnection class without running out of memory?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Danny_Price
Posted On:   Tuesday, May 22, 2001 01:28 PM

Is there anyway to send large files to a server using a HttpURLConnection? I need to send sometimes very large files, and it seems like the HttpURLConnection buffers the output before sending it to the server. This causes my system to run out of memory, unless I start the client piece with a really large memory space. I have the client set up to POST a url to the server using the multipart/form-data content-type, but it seems like it tries to read in the entire file before streaming it across the network.

Any help is appreciated.

Re: How can I send large files to a HTTP Server using the HttpURLConnection class without running out of memory?

Posted By:   Christopher_Schultz  
Posted On:   Tuesday, May 22, 2001 01:50 PM

I have actually never tried doing this, but I'd imagine that you could wrap the OutputStream from the HttpUrlConnection with a BufferedWriter or something and periodically flush() that buffer.



Specifically, what is the stack dump you're getting when your application bombs? Is HttpUrlConnection dying, or is it the underlying OutputStream?



-chris
About | Sitemap | Contact