.mp3 file download using HTTP


Hi all…
The job is to download a .mp3 using Q24 GPRS. I am able to download a .txt file correctly. But with .mp3, when I play it, player doesnot recognize it. I have implemented the code this way.


In the event handler ‘http_event_handler’, I am reading the bytes using wip_read(ch,rcv_buffer,sizeof(rcv_buffer)))>0.

I am displaying the recieved characters on Hyperterminal and capturing them into a file. When I play the file using Windows Media Player, the file seems to be corrupted or say not recognized.

Any help regarding mp3 file download using WIP is appreciated.



Hyperterminal may not able to handle all characters correctly. You can try some other terminal applications like MTTY … :confused:


Hyperteminal should handle characters correctly - but MP3 is not a text file format!

MP3 is a binary format - so it should not be expected to display correctly in any text display such as a terminal emulator…!


I am not worried about how the contents are displayed on the hyperterminal.I am capturing the received bytes in a file and trying to play using Windows Media Player but in vain.Am I missing any header information that has to be specified when making the request? Has anybody worked on mp3 or anyother audio file download using WIP/HTTP? Or a direction towards the solution will also be helpful.



Just a suggestion: compare what you received with the original file, retrieved by more conventional ways (e.g. with your html browser). Maybe if you know what is the exact corruption of the file, what went wrong will become clearer.


Hi fft,
I have done that using beyond compare.The original file(PC internet downloaded) and the GPRS downloaded file are entirely different :frowning: .
I have the the following on mind:
Char-set : Something to do with the character encoding.
Is the data transfer compressed in some format(Transfer endcoding header of HTTP)
Am I missing any HTTP header that has to be specified to the server?

Lately, I tried with FTP. The situation has not changed.
Please find the original.mp3 in text format and the GPRS downloaded one (gprs.mp3)attached with this email.
Please let me know if you can make anything out of it…

Hey I am not able to upload the files :frowning:
Tried uploading them as mp3s, .txt
Nothing works… :frowning:
Is there any way i can send the files?



Have you tried Fiddler to watch what actually happens when your PC browser does the download?

When you download the file using your Q24, how do you then transfer it to the PC?

Maybe the problem lies in the transfer to the PC, rather than the download itself?


Hi awneil…

I shall try using Fiddler tool and will post the observations.

Alright heres the scenario of my experiment.

I have the WIP/FTP/HTTP application running on Q24.
Using the adl_atSendResponse, I am trying to send the received bytes to the hyperterminal. On the hyperterminal using the Capture text option, I am trying to capture the bytes as soon as the download of mp3 starts. There are none other debug msgs sent to the hyperterminal. Only the downloaded bytes are sent and captured.
Using both the protocols, HTTP and FTP, I am capturing the bytes.

I am trying to open the captured file using Windows Media Player. But it doesnot recognize the file and hence fails to play it.

Hey would want you guys to see the original file and the wavecom downloaded file.
Only if u guys think that it would.
Have been trying this since 2 months. Finally resorted to you people for help.
Hope this would end up with a solution or even a hint.



That sounds like a bad idea to start with!

  1. I don’t think adl_atSendResponse is intended to work with binary data :question:
  2. As already explained, Hyperterminal is certainly not designed to display binary data like this!

The clue is in the name: the “Capture text option” is for capturing text - not binary data!
To capture binary data, you should use a proper binary transfer protocol.


Hi awneil
Yea. Fiddler was an interesting tool.
Hey, I am able to get the hex values of the bytes downloded using GPRS.The hex values exactly match the hex values found under Hex section of Fiddler tool.Wondering if that could help in any way. Does this observation help you in any way?
Any idea you could suggest me?
I did a small experiment mean while.
On my PC tried to open a mp3 file, read it character by character and tried to cpy it into another file.(Wrote it in C)
Then tried to play the copied file in Windows Media Player, it says the same thing. Corrupted.
Anything I can try with the hex bytes ?



I think you are probably confusing the actual raw binary data with the ASCII-coded textual display of that data:

eg, the number 0x12 is a single byte with the numeric value of eighteen (decimal); if you want to display that, in hex, you need to display a ‘1’ character followed by a ‘2’ character.

Now characters are commonly encoded using ASCII, in which the character ‘1’ is represented by the numerical value 0x31, and the character ‘2’ is represented by the numerical value 0x32.

Thus, to display or send the single byte value 0x12 in text format, requires two characters - encoded as the two byte values 0x31 followed by 0x32.

Clearly, if you feed the ASCII-coded text into something expecting the raw binary data - you will have problems!


Hey all,
I am able to play the song.
The fund is… try reading the bytes in hex form.
later convert them to binary.
This would then play the song.
Thanks everyone for ur time.