Ulf Dittmer wrote:A few comments in no particular order.
1) In the client code, the ByteArrayOutputStream is unused and unnecessary.
2) If the file size exactly 1024 bytes? If it is larger, the code is sending partial content that will be corrupted. If it is smaller then the code sends too many bytes, again possibly corrupting the contents - the number of bytes in the packet should be what fis.read returns, not the size of the byte[].
3) Have you gotten this client/server pair to work? If not, start with that.