由相同应用组成的分布式网络

发布于 2024-12-17 20:02:40 字数 373 浏览 1 评论 0原文

我带着相当哲学的问题来到这里:

假设我们有两个相同的应用程序,具有相似的设置范围。 我们希望这些应用程序可以通过套接字进行通信。

据我所知,在点对点应用程序中,其中之一应该是主动(客户端)和被动(服务器),即客户端“连接”,服务器应该处于“接受”状态。这导致我们必须在运行它们之前知道谁是活跃的,谁不是活跃的。

正如我之前提到的,我想让这个应用程序完全相同。并让两个相同的应用程序可以连接到网络上,以某种方式做出明智的决定谁是谁。

考虑这个问题是因为我希望每个新应用程序都可以连接到其他应用程序的网络,而只需知道其中一个应用程序的 IP 地址。

免责声明:这不是恶意软件。它是ERP系统的传输层。

如果有任何想法、链接等,我将非常高兴。

I've come here with quite philosophical problem:

suppose we have two identical application, with similar range of settings.
and we'd like these application can communicate via sockets.

As far as I know in point-to-point application one of them should be active(client) and passiv(server) i.e. client do "connect" and the server should be in state of "accept". This lead us to necessity to know who is active and who isn't before we run them.

As I've previously mentioned I want make this application identical. And let two identical application can be connected throw net, making somehow smart decisions Who is Who.

This question is considered due to the fact that I want each new application can be connected to the net of other applications with just knowing ip adress of one of them.

Disclaimer: It's not a malware. It's a transport layer of ERP system.

I would be very pleased for any ideas, link etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

八巷 2024-12-24 20:02:40

选项:

  • 指定一个应用程序始终作为服务器。它开始侦听某个端口,而另一个应用程序启动时将尝试重复连接到服务器,直到成功。
  • 两者都充当服务器和客户端。一台主机上的应用程序启动并尝试连接到另一台主机,如果无法连接,则会启动服务器侦听来自另一台主机的连接。另一台主机上的应用程序也执行相同的操作。应添加重试以避免竞争条件。
  • 让它们各自充当客户端并连接到第三个服务器。然后,他们通过该服务器进行通信,或者该服务器告诉他们如何相互通信(例如,服务器可能会告诉一个应用程序作为服务器,并告诉另一个应用程序作为客户端)。

Options:

  • Designate one app to always be the server. It starts up listening on some port, and the other app when it starts up, will try to connect to the server repeatedly until it is successful.
  • Have both act as both a server and a client. App on one host starts up and tries to connect to the other host, and if it can't then it starts up a server listening for a connection from the other host. The app on the other host does the same. Should add in retries to avoid race conditions.
  • Have them each act as clients and connect to a third server. They then communicate through that server, or that server tells them how to communicate with one another (the server might for example tell one app to be a server, and tells the other app to be a client).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文