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

查看:113
本文介绍了没有服务器的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天全站免登陆