I am supposed to implement a simple Client/Server application similar to FTP Server/Client .
Both the client and the server should be able to send and receive files, but for now let's address just sending a file from the server to the client.
There is already an open socket between them, I do not wish to use a byte buffer. I tried the Files.copy() method, it created a file at the client side but it was filled with rubbish.
I have been trying to use FileChannel.transferFrom/To but I can't seem to get it right.
could someone provide an example of how to use it over a socket ?