Originally posted by aymane chetibi:
I have added this condition that the bytesRead are less that 1024, than we have to finish looping, because before it stayed blocked somewhere even if it's finished.
[/QB]
Keep in mind that the number of bytes can be less than the size of the array for several reasons, not just EOF. Network congestion for one.
I would expect that you would get a Exception when you try to read after the server has invoked socketFromClient.close(). Are you writing exceptions out? In any case, the most reliable way to move a file using a custom protocol that I've found is to send the file size, then read that many bytes.
As for different behavior on client and server, are you sure you are keeping the classes in sync?
Exactly what is the problem? You said the "first ten offsets are different". What do you mean by that? Is it only the first ten, or is that all you've checked?