I have a chat program in which two clients connect to each other and can send images back and forth to each other. However, I noticed that after running the program for a little bit and sometimes even very immediately after starting the program (not sure what is the cause), but all of a sudden some strange ASCII characters start to print in the chat area (where it otherwise shows the messages sent back and forth by users). The program also gets affected by users not being able to receive images (sometimes this only happens temporarily then goes away, while other times it keeps printing the junk and causes the program to be unresponsive.
I know it's impossible to tell me EXACTLY how to fix this without seeing any code, but does anyone at least have an idea of what might be causing this?
P.S. I've got some stuff like this in my code:
BufferedReader in = new BufferedReader(new InputStreamReader(clientSocketA.getInputStream()));
PrintWriter out = new PrintWriter(clientSocketA.getOutputStream(), true);
....................................
FileInputStream fis = new FileInputStream("UserA.jpg");
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
oos.writeObject(buffer);
This post has been edited by DecafJava: 01 December 2009 - 04:33 PM

New Topic/Question
Reply



MultiQuote






|