hello everyone..i'm trying to get a file in a server using a WebRequest..the server sends some headers saying "Transfer-Encoding :chunked"..what does this basically mean??? I'm using a BinaryReader to read the data..but after some few hundred bytes the transfer just stops..do i have to make a WebRequest again to get the remaining portion of the file??? Please help.

Recommended Answers

All 15 Replies

hey thanks for reply..it works this way..one more question, if the server uses UTF-8 encoding,does it apply to the binary data in file transfer too or just the text type??

...not sure. Is your download coming to you with the wrong encoding?

yeah i get the HTML code..then the transfer stops..but the data i want to retrieve is a stream audio..and I don't know how to access it..could you tell me how to do that??

Did you open a stream?


protected static Stream GetRepsonseStream(string strURI)
         HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strURI);
         req.ProtocolVersion = HttpVersion.Version10;
         return req.GetResponse().GetResponseStream();

Also, if you did, I saw this post on keeping the sample rate low

yeah and after getting the stream..i'm using a binaryreader to read the stream..

BinaryReader reader = new BinaryReader(dataStream);
byte[] b = new byte[999999];
int index = 0;        
while ((reader.Read(b, index, 2000)) != 0)
    index += 2000;              

my confusion is that..the server is sending HTML codes n stopping the transfer..how do i get an audio stream?? (suppose i'm playing a streaming mp3 file)

Right. Do you have a URI to the actual stream?

What happens if you just use the stream and not the BinaryReader?

if just retrieves the HTML page n stops the transfer

Do you have a public page with this kind of stream on it where I can try something?

OK. There is LOTS of content on that page.
Which piece are you trying to get?

well the first video or the 2nd one..anything does just need to know how to do this

That is a completely different problem.
Those are YouTube videos and require different handling altogether.

You can harvest some code from this YouTube Downloader on codeplex or you can get a utility like CucuSoft YouTube Mate if you just want the video without coding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.