c# - Access content-length in custom WCF MessageEncoder -
i attempting show progress of streamed wcf message implementing custom messageencoder , overriding readmessage method. can download data , report progress coming in interested know full message size before happens.
is possible in encoder or somewhere else see size of incoming message before downloaded? know length available in http headers don't see way access them.
here have far:
public override message readmessage(stream stream, int maxsizeofheaders, string contenttype) { memorystream content = new memorystream(); byte[] buffer = new byte[512]; var bytesread = 0; { bytesread = stream.read(buffer, 0, buffer.length); content.write(buffer, 0, bytesread); // report progress this.reportprogress("downloading...", bytesread); } while (bytesread > 0);
Comments
Post a Comment