没有中央服务器的聊天程序
我正在开发一个聊天应用程序(在 VB.Net 中)。这将是一个“安全”的聊天程序。所有流量都将被加密(我还需要找到最佳方法,但这不是现在的问题)。
目前该程序有效。我有一个服务器应用程序和一个客户端应用程序。不过,我想设置该应用程序,以便它不需要中央服务器即可工作。
我可以采取什么方法来分散网络?
我认为我需要以某种方式开发客户端,以便它们也充当服务器。
客户端如何知道它需要连接哪台服务器/如果服务器宕机会发生什么?如果没有中央服务器,客户端/服务器现在网络中还有哪些其他节点?
充其量我不希望客户端知道不同节点的 IP 地址是什么,但是我认为如果没有中央服务器,这是不可能的。
如前所述,该应用程序将用 VB.Net 编写,但我认为此时该语言并不重要。
只是想知道我可以遵循的不同方法。
I'm developing a chat application (in VB.Net). It will be a "secure" chat program. All traffic will be encrypted (I also need to find the best approach for this, but that's not the question for now).
Currently the program works. I have a server application and a client application. However I want to setup the application so that it doesn't need a central server for it to work.
What approach can I take to decentralize the network?
I think I need to develop the clients in a way so that they do also act as a server.
How would the clients know what server it needs to connect with / what happens if a server is down? How would the clients / servers now what other nodes there are in the network without having a central server?
At best I don't want the clients to know what the IP addresses are of the different nodes, however I don't think this would be possible without having a central server.
As stated the application will be written in VB.Net, but I think the language doesn't really matter at this point.
Just want to know the different approaches I can follow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
例如,查看 Kademlia 协议的论文 (你可以找到在这里)。如果您只想快速了解,请查看维基百科页面 http://en.wikipedia.org/wiki/卡德姆利亚。 Kademlia 协议定义了一种以分散方式在网络中查找节点的方式。它已经成功地应用在eMule软件中——因此经过测试它确实可以工作。
将其应用到您的聊天软件中应该不会造成严重问题。
Look for example at the paper of the Kademlia protocol (you can find it here). If you just want a quick overview, look at the Wikipedia page http://en.wikipedia.org/wiki/Kademlia. The Kademlia protocol defines a way of node lookups in a network in a decentral way. It has been successfully applied in the eMule software - so it is tested to really work.
It should cause no serious problems to apply it to your chat software.
您需要一些已知的IP地址,以便客户端最初进入网络。一旦客户端成为网络的一部分,事情就可以更加去中心化,但第一步需要一些东西。
基本上只有两种选择 - 要么用户提供一个(对于网络的现有节点 - 本质上是 BitTorrent 跟踪器的工作方式),要么你在网关节点(实际上是中央服务器)中进行硬编码。
You need some known IP address for clients to initially get into a network. Once a client is part of a network, things can be more decentralized, but that first step needs something.
There are basically only two options - either the user provides one (for an existing node of the network - essentially how BitTorrent trackers work), or you hard-code in a gateway node (which is effectively a central server).
也许你可以看到uChat程序。这是一个来自 uTorrent 创建者的程序,无需服务器即可进行聊天。
这个想法是从磁力链接连接到群并使用它来发送和接收消息。这是琥珀色的答案,你需要一个接入点,可能是一个服务器,一个已知的群,手动IP等。
这是uChat演示:http://blog.bittorrent.com/2011/06/30/uchat-we-just-need-each-other/
Maybe you can see uChat program. It's a program from uTorrent creator with chat without server in mind.
The idea is connect to a swarm from a magnetlink and use it to send an receive messages. This is as Amber answer, you need an access point, may it be a server, a know swarm, manual ip, etc.
Here is uChat presentation: http://blog.bittorrent.com/2011/06/30/uchat-we-just-need-each-other/