没有服务器的 TCP P2P [英] TCP P2P without server

查看:22
本文介绍了没有服务器的 TCP P2P的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在没有服务器的情况下编写 TCP P2P 程序?当我在谷歌上搜索这个问题时,我发现了一些关于 NAT 遍历,UPnP,我可以以某种方式使用它们吗?

is it possible to write TCP P2P program without server? When I was googling this question I found something about NAT traversal,UPnP, can I use them somehow?

推荐答案

是的,你可以(正如 GrandmasterB 指出的那样,每个对等方都有服务器和客户端套接字).但是,您可能已经知道,NAT 会给您带来痛苦.

Yes you can (where as GrandmasterB points out, each peer has both server and client sockets). However, NATs will cause you pain, as you may already know.

如果您不能使用中间件(客户端连接到的公共 IP 地址上的服务器 (*)) - 您可能不想要这些,因为它们与 P2P 的观点相反 - 而您不介意用 SDP 描述您的连接详细信息,您可以尝试 交互式连接建立.

If you can't use middleboxes (servers on public IP addresses to which your clients connect (*)) - and you might not want these, because they're rather contrary to the point of P2P - and you don't mind describing your connection details with SDP, you could try Interactive Connectivity Establishment.

本质上,ICE 会尝试不同的连接策略.这是一个可插拔的架构,因此您可以添加自己的自定义策略.默认情况下,ICE 描述了 UDP 遍历技术,但是一个 扩展 允许 TCP 连接的工作正在进行中.

Essentially, ICE tries different strategies to connect. It's a pluggable architecture, so you could add your own custom strategies. By default ICE describes techniques for UDP traversal, but an extension to allow TCP connectivity is in the works.

(*) 你总是可以尝试像 IRC 这样的架构,在那里你有任意数量的服务器相互对等,客户端连接到这些服务器.这至少是 P2P 的一半.(这几乎也是 SIP 使用的架构.)

(*) You could always try an architecture like IRC, where you have any number of servers peering amongst themselves, to which clients connect. That's halfway to P2P at least. (This is also pretty much the architecture SIP uses.)

这篇关于没有服务器的 TCP P2P的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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