Hi Folks, here is my server code. Seems the client is sending it correctly. A 1045 characters were sent with 1024 bytes and then 21 bytes in the next block. When it is read by the server, I see 1024 and 1024. Here is the code snippet. public void run() { try { int i = 0; byte[] buffer = new byte[1024]; System.out.println("Binded"); int bytesRead=0; while (true) { i++; InputStream fis = socket.getInputStream(); DataInputStream bis = new DataInputStream(fis); FileOutputStream fos = new FileOutputStream(new File("temp" + i + ".dat")); while ((bytesRead=bis.read(buffer)) != -1) { System.o
More>>

Hi Folks, here is my server code. Seems the client is sending it correctly. A 1045 characters were sent with 1024 bytes and then 21 bytes in the next block.

When it is read by the server, I see 1024 and 1024. Here is the code snippet.

}
if (i == 20) { // It was making a lot of tempxxx.dat files so I am ensuring that it
// writes only 20 files at the max. I want this check removed, since the program
// should have created only file.
fos.close();
bis.close();
fis.close();

}
}

Another issues is, that instead of 1045 bytes which my original file has, this one creates 2048 bytes file with name "temp1.dat" and then creates a lot of "0" bytes file