Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Latest commit

 

History

History
67 lines (66 loc) · 1.23 KB

Tranmission.md

File metadata and controls

67 lines (66 loc) · 1.23 KB

发送端 -> 接收端
发送文件信息,请求接收端是否接收

{
    "type": 1,
    "data": {
        "fileName": "文件名称",
        "fileSize": 111111,
        "fileHash": "文件hash",
        "commandPort": 111
    }
}

接收端 -> 发送端
发送是否接收文件

{
    "type": 2,
    "data": {
        "isAccept": true,
        "sendPort": 1111
    }
}

发送端 -> 接收端
发送端要继续发送文件,请求接收端告诉发送端文件的接收情况

{
    "type": 3,
    "data": {
        "fileHash": "文件hash"
    }
}

接收端 -> 发送端
发送文件接收情况

{
    "type": 4,
    "data": {
        "fileHash": "文件hash",
        "sections": [
            {
                "startIndex": 111,
                "endIndex": 222,
                "finishIndex": 333
            },
            {
                "startIndex": 111,
                "endIndex": 222,
                "finishIndex": 333
            }
        ]
    }
}

发送端 -> 接收端
真正发送文件数据的时候,每个分块socket先发送以下信息

{
    "fileHash": "文件hash",
    "startIndex": 111,
    "endIndex": 222,
    "finishIndex": 333
}