This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
i was trying to come up with a program where the client would be sending a audio file to a server and the server would be saving it. I am unable to find what is wrong with my program (it's getting stuck) can some one help me with this program.
Which while loop? There are several. Which of the conditions for loop termination is not being satisfied?
You're explicitly checking for character #13, which is a carriage return. Are you sure one is being sent? That's one of the differences between Unix and Windows.
(As an aside, I'd also simplify the code by removing all unnecessary code. For example, "InputStreamReader isr" and "PrintWriter os" are not being used in the server code, so you should delete all traces of them, lest they interfere with the code's operation.)
Joined: Jun 09, 2009
Sorry for not providing the complete information
It's actually getting stuck in the 34 line ( while(currentsize<size&&(character=is.read(buffer))!=-1) ) in the Server program. Most of the file is getting transfered but by the time it reaches the last few bytes of the file its just getting stuck. I even tried to debug it in eclipse debug mode but could not trace anything.