是否可以编写一个无需中央服务器即可检测并连接到对等点的应用程序?如何?
是否可以编写一个无需中央服务器即可检测并连接到对等点的应用程序?如何?
我相信这就是一些点对点应用程序所做的,但我在编程方面的知识比在网络方面的知识要好得多。
假设您想要创建一个按以下方式工作的私人聊天应用程序:
- 您定义您信任的 ID 列表
- 该应用程序显示具有相同应用程序并具有受信任 ID 的所有对等点
- 您建立一个连接,允许您聊天发送小型文档(源代码、odt 文件等),无需在路由器中打开端口。
当然,我并不是期待一个灵丹妙药的答案,只是一些可行性的线索,以及这需要的技术。
Is it possible to code an application that can detect and connect to peers without a central server? How?
I believe this is what some peer-to-peer applications do, but my knowledge in programming is much better than in networking.
Let's say you want to create a private chat application that works the following way:
- You define a list of IDs you trust
- The application displays all the peers that have the same application and have a trusted ID
- You establish a connection that allow you to chat and send small documentations (source code, odt files, etc.) without the need to open a port in the router.
I'm not, of course expecting, a silver bullet answer, just some clues of the feasibility, and the technologies this would require.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您的应用程序要运行的网络类型,对于 LAN 网络,您可以执行以下操作:
可用的同行。
像这样:我的peer ID:xxx,我的ip地址是192.168.1.44,
4567 上的侦听端口。
当然,您必须设计一个广播协议来获取可用对等点的列表。一个简单的广播协议可以有以下选项:
查询可用对等体的对等体的IP地址,因此其他人将响应此IP,广播协议的端口号。可用的对等方将回复以下信息:
聊天应用程序的 IP 地址、端口号。
现在,聊天应用程序可以使用此信息与这些对等点进行连接。
这适用于 LAN 网络,但为了识别互联网上的对等点,我没有找到不依赖中央服务器的解决方案。
抱歉我的英语不好,我希望至少你现在有了一个想法。
That is depend in what type of network your application going to run in to, for LAN networks, you can do this:
available peers.
like this: I am peer ID: xxx, and my ip address is 192.168.1.44, with
listening port on 4567.
Of course, you have to design a broadcast protocol to get list of available peers. A simple broadcast protocol could have the following options:
The IP address of peer who queried for available peers, so others will respond to this IP, port number of broadcast protocol. The available peers will respond with this information:
IP address, port number of the chat application.
Now the chat application can use this information to connect with those peers.
This will apply for LAN networks, but to identify peers on internet I didn't find a solution with out relying on central server.
Sorry for my English, and I hope at least you have an idea now.