Skip to content

Hughsean/MultiThread-FileTransferr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

多线程网络文件传输

传输时序

sequenceDiagram
participant s as Server
participant c as Client
c->>s:访问控制端口<br>file[name, length](json)
note over s:创建N个线程, 随机分配数据端口, 向任务池提交任务
s->>c:文件块id对应port<br>array[id:port]
note over c:根据id:port映射, 创建N线程, 访问服务端对应端口
	loop Client每一个线程实体
		c-->>s:Socket.Connect
	end
note over s:接受Client.Socket
	loop Server每一个线程实体
		c-->>s:传送字节流
	end
s->>c:接收完毕
note over s,c:释放资源
Loading

DownWork==>UpWork:

{
	"progress":"int: 接收进度",
}

Scan

{
    "TYPE":"SCAN",
}

Respond:

{
    "TYPE":"RESPOND",
}

send:

{
    "FILENAME":"string, 文件名称",
    "FILESIZE":"uint64, 文件大小"
}

tcplisten:

[
    {
       "ID":"int, 文件块id",
       "PORT":"int, 端口号"
    }
    // ...
]

App CMD:

  • help: 获取帮助
  • scan: 扫描局域网, 获得局域网内设备ip
  • connect [ip]: 连接到ip
  • send [file] [ip]: 发送文件[file][ip]
  • exit: 程序退出

About

课程设计:多线程网络文件传输

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published