对等文件传输的协议建议 [英] Protocol recommendation for Peer to Peer File Transfer

查看:47
本文介绍了对等文件传输的协议建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现点对点文件传输.

I need to implement a Peer To Peer File Transfer.

我应该使用什么协议?TCP 还是 UDP?为什么?

What protocol should I use? TCP or UDP? And why?

推荐答案

当您想要确保数据以适当的完整性到达其预定目的地时,TCP 通常是最佳选择.

TCP is generically the best way to go when you want to ensure that your data gets to its intended destination with appropriate integrity.

在你的情况下,我会亲自选择 tcp,因为你可能最终会在你的 udp 数据包内以某种形式重新实现 tcp(要求块(syn),回答:我有块(syn ack),好的发送它对我来说(确认)...数据:(推确认)......完成:(rst))

In your case I would personnally choose tcp, because you will probably end up reimplementing tcp in some form inside of your udp packets otherwise (ask for block (syn), answer: i have block (syn ack), ok send it to me (ack)...data: (push ack)... ok done: (rst))

一般来说,udp 是您想要广播时要走的路,并且您并不真正关心数据是否到达那里,这意味着存在高冗余或低重要性/完整性......因为文件需要高完整性,再次使用 UDP 没有多大意义,除非您想完成额外的工作.

Also generically speaking, udp is the way to go when you want to broadcast, and you dont really care if the data gets there or not, meaning there is either high redundancy or low importance/integrity... since files require high integrity, it doesn't make a lot of sense to go UDP, again, unless you want to go through the extra work.

udp 唯一的好处是它是无状态的,它可以在文件共享程序中得到一些很好的实现.

The only upside to udp would be the fact that is stateless, which could have some good implementations in a file sharing program.

底线...随心所欲...

Bottom line... go with your heart...

这篇关于对等文件传输的协议建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆