Giter Club home page Giter Club logo

Comments (5)

DayChan avatar DayChan commented on July 18, 2024

我理解错了,是要断点续传
但是好像如果一个文件正在传,一个新socket过来,要传的是相同文件名但是数据实质不同就乱了
也许可能应该是md5作路径,文件名记录到数据库

from sftp-java.

DayChan avatar DayChan commented on July 18, 2024

https://blog.csdn.net/wangshuminjava/article/details/103894021

from sftp-java.

bx-h avatar bx-h commented on July 18, 2024

牛逼,线程安全吗,我今天刚想进一步实现一下。
如果有线程正在上传中,确实应该给文件加个锁。
另外如果是下载的话,我在想可不可以用ThreadLocal包装一下断点,每个线程有自己独立的断点位置,哪个线程来了按自己的位置下载即可。
而上传的话,我觉得谁初始上传的,断传之后接着上传的也只能是它,不能够并发上传,因此在断传之后确实可以给文件加md5

from sftp-java.

DayChan avatar DayChan commented on July 18, 2024

直接在客户端计算md5传过来当文件名就行了
我是看你这个是按文件名来判断的,如果两个人同时传一个相同文件名的文件就乱了
然后线程安全是保证两个人同时传完全相同的文件(md5相同)时,服务端在写文件时有保障。并发传应该不止断传后重传会出现
断点位置我觉得可以在客户端记录,然后在服务端这边校验一下,如果断点位置跟服务端文件大小不符合,或者其他校验判断不符合,直接从头传就行
每个线程有自己的断点,但是如果传一半网断了的话,重连是会accept新的socket的?这样建的不是新的thread么

from sftp-java.

bx-h avatar bx-h commented on July 18, 2024

有道理有道理

from sftp-java.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.