Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Data loss during file transfer

 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic