httpwebresponse , how to kno if contents are received completely?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • libish
    New Member
    • Oct 2008
    • 42

    #1

    httpwebresponse , how to kno if contents are received completely?

    hi all..
    can any one help me to kno whether i have received the response stream completely...

    below are the code that i'm using... but i'm not able to receive data completely.. some datas are missing...
    i'm not using thread here... is it the reason why i'm not able to..

    Code:
    HttpWebResponse response = (HttpWebResponse)oWebReq.GetResponse();
                             
                byte[] resBytes = new byte[response.ContentLength];
                Stream resstream = response.GetResponseStream();
                resstream.Read(resBytes,0,resBytes.Length);
               
                response.Close();
  • hdsk
    New Member
    • Oct 2008
    • 8

    #2
    The only way is by checking the content-length response header at least the response is chunked. If the content-type is chunked the content-length is useless, you sould parse the body line by line, the first tell the lenght of the chunk, then cames the data and then another line telling you the next length until the length is 0.

    Normally the response is not chunked but it will in many cellphones if you use the flush opeartion.

    Regards:
    Harold.

    Comment

    Working...