[.NET C#] HttpWebRequest & Stream, problem to flush the buffer.

R

r0main

Hi,

I'm facing an issue to send data throught the HttpWebRequest processing,
I'm using the Method POST with a multipart form/data.

While writing a file, my application is buffering the whole size of the
file, and it sends it... That's pretty sucks with large file.

while ((bytesWritten = fileStream.Read(b, 0, 4096)) > 0)
{
newStream.Write(b, 0, bytesWritten);
newStream.Flush();
this.singleFileProgressBar.PerformStep();
}
newStream.Close();

I thought this piece of code will resolve my problem, but the Flush()
Method must be overrided.

How to flush the data on each turn during my loop ?
How can I override the Flush() Method ? I really don't know what to code
inside of it.

Thanks !
 
V

Vadym Stetsyak

Hello, r0main!

r> I'm facing an issue to send data throught the HttpWebRequest processing,
r> I'm using the Method POST with a multipart form/data.

r> While writing a file, my application is buffering the whole size of the
r> file, and it sends it... That's pretty sucks with large file.

r> while ((bytesWritten = fileStream.Read(b, 0, 4096)) >
r> 0)
r> {
r> newStream.Write(b, 0, bytesWritten);
r> newStream.Flush();
r> this.singleFileProgressBar.PerformStep();
r> }
r> newStream.Close();


[skipped]

What type has newStream? How do you obtain it?
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top