I know how to read a file bytes, but I can not find an example of how to read it in pieces of bytes. I have an array of bytes and I want to read a 512 byte file and send them through the socket.
I tried to read the total number of bytes of the file and then subtract 512 bytes, until I received a fragment that was less than 512 bytes, and signaled EOF and the end of the transfer.
I am trying to implement TFTP where data is sent in 512 bytes.
Anyway, thanks for the example.
source share