Click here to Skip to main content
15,894,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello..
I am trying to write a code in socket programming using java that would transfer audio files from 1 destination to another.
I am able to read the audio file successfully using AudioInputStream and AudioSystem methods.
However, i am unable to write back the same file to the destination. The client side does not receive the audio file properly.
Please can u help me?
I was able to successfully transfer a simple text file..but it just doesn't seem to work for audio files..

Thanks n regards..
Posted

Probably fragmentation is the problem if you can write simple text file.

You can try serialization through socket or you could say it is just a file(dont care its type) and read it into a byte container and send it through socket each time you read. Here a suggestion could be useful, dont use too big container, you can use a byte array sized 256.
 
Share this answer
 
Could you please elaborate??
What exactly do u mean by fragmentation of code?
 
Share this answer
 
I already answered this question here[^]; please do not post in multiple forums, it just confuses the issue.

The issue being: read your file as a byte stream and send it to the client. The client should save as a byte stream. The client copy of the file should be an exact copy of the original. If this is not the case then I suspect you are not following the above model.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900