• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data loss during file transfer

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am loosing data when I send it to my client. How do I figure this? When I receive the data (music) and play it, it sounds off. Some sounds don't play correctly and sound like they are missing some data. While the general music audio lines are still hearable, it just sounds like the quality is off. When I play the songs without the transfer, they sound fine. I am guessing there is something wrong with the way I do the transfer. Small amounts of bits are being "chewed off" (sorry, I couldn't resist) and you can hear it. Please note that I tried this on my computer and on another computer through my network. They sounded the same, so it isn't my internet connection. I also tried it with "localhost". It was the same quality, poor.

Thanks,
John Price

EDIT : Please try this code yourself. It runs 100% fine. Just put the server in a folder, along with a file named "SongList.txt". You will need a WAV, AU, or other supported file type audio files in the server folder. "SongList.txt" should contain a list of those audio files. Here is a sample of what is in "SongList.txt" :


Server :


Client :
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot receive binary data as a String using a Reader of any kind and then convert it to bytes without some data loss. Readers interpret the data they read, making various substitutions. You must instead use an InputStream to read the raw bytes directly.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You aren't closing your resources properly. This might cause "weird" behaviour. Also there are some places in your code where you should use generics.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I guess this is a little old. Haven't worked on the project for awhile, but the "parsing to from string" isn't an issue anymore as I fixed it awhile ago (in more recent posts).

Closing the topic,
John Price
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic