How to continue loading a Java file (socket)

I am making a program that sends large files through client-server sockets, this piece of code

while ((bytesRead = in.read(mybytearray, 0, mybytearray.length)) != -1) {
     bos.write(mybytearray, 0, bytesRead);
}

All code can be found here.

Have I uploaded data to transfer this number to the spooled file? For example, there is a file size of 35,000 bytes transferred to 20,000, and how to get the program to start downloading from 20,000 bytes to continue? PS I'm sorry, my English is bad

+4
source share
1 answer

When you open a connection to the target file, just keep reading it until you reach 20,000 bytes, discarding the data.

After you reach your “resume point”, add new data to the existing file.

, "" , /.

+3

Source: https://habr.com/ru/post/1523787/


All Articles