gpt4 book ai didi

sockets - 可靠的多播库 C++

转载 作者:行者123 更新时间:2023-12-03 11:55:31 26 4
gpt4 key购买 nike

enter image description here

我知道 thisthis stackoverflow 问题回答了实现“可靠多播”的已知方法,但我遇到了一些网站,其中提到甚至路由器也应该被编程为处理通过 UDP 设计的自定义协议(protocol),这是真的吗?

基本上我想为我的应用程序使用多播,并且我不想对更改路由器施加任何限制以配置自定义协议(protocol)以可靠的方式处理 UDP,例如我正在考虑通过 UDP 实现/使用 PGM 协议(protocol)来处理多播但有人说路由器也应该支持 PGM,这限制了我提供解决方案,因为客户应该为我的解决方案更改基础设施,这是没有根据的。

请让我知道是否有任何解决方案可以实现以可靠的方式处理 UDP 数据包,而无需对网络基础设施进行任何更改。

提前致谢。

编辑:

我并不是说我不想在路由器中启用多播,我肯定会在路由器中启用多播路由。当我读到 PGM 实现时,有人说即使路由器也应该支持 PGM,我认为这与商店中的商用路由器不同。我的理解错了吗?

最佳答案

如果您不能或不想将路由器配置为转发多播流量或以其他方式处理第三方协议(protocol),则需要通过单播链路传输多播流量。 UFTP能够通过使用 UFTP 代理服务器进行多播隧道。

从手册页:

The proxy can run in one of three modes: a server proxy, a client proxy, or response proxy.

A server proxy is typically local to a server and acts as the upstream end of a multicast tunnel. It listens on the public multicast address (and private multicast address when specified) and forwards downstream packets to a specific address downstream. Upstream packets are forwarded back where the announcement originated from.

A client proxy is typically local to one or more clients and forms the downstream end of a multicast tunnel. It receives unicast data from one or more server proxies and forwards downstream traffic to the multicast address specified in the packet header. Upstream traffic from clients is gathered and forwarded back where the announcement came from as an aggregated response.



下面是一个典型配置图,其中服务器向本地网络发送多播消息,一个或多个服务器代理将消息单播到相应的客户端代理,然后再将消息多播到其本地网络。
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x Network A x
x ---------- x
x | Server | x
x ---------- x
x | x
x | multicast x
x | x
x |----------------------------------------- x
x | | | x
x v v v x
x ---------------- ---------------- ---------- x
x | Server Proxy | | Server Proxy | | Client | x
x ---------------- ---------------- ---------- x
x | | x
x | unicast | unicast x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| |
| ------------
| |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxx
x | Network B x x | Network C x
x v x x v x
x ---------------- x x ---------------- x
x | Client Proxy | x x | Client Proxy | x
x ---------------- x x ---------------- x
x | x x | x
x | multicast x x | multicast x
x | x x | x
x |------------- x x |------------ x
x | | x x | | x
x v v x x v v x
x ---------- ---------- x x ---------- ---------- x
x | Client | | Client | x x | Client | | Client | x
x ---------- ---------- x x ---------- ---------- x
x x x x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxx

这些代理也能够在 NATed 环境中工作:

If a client proxy is behind a firewall, the proxy can send a heartbeat message to the upstream proxy to make a pinhole in the firewall that the upstream server proxy can connect to. If the client proxy is also NATed, the upstream server proxy may not know the IP/port of the client proxy, so the server proxy can be configured to wait for a heartbeat message, and use the IP/port the heartbeat came from as its downstream address. If the server proxy is also behind a firewall or NAT, a second server proxy on a machine with a publicly accessible IP can be inserted between the first server proxy and the client proxy. In this case, the first server proxy is set up to use the second as its downstream address, and the second server proxy is set up to use the first heartbeat it receives from a client proxy as its downstream address.



我是这个软件的作者,所以如果您需要有关如何设置它的指示,请通过 UFTP 页面底部的链接给我发送电子邮件,我们会看看我们能做什么。

更新:

在 PGM 的情况下,它可以配置为在应用层(即在 UDP 之上)或在传输层(即直接在 IP 之上)运行。如果 PGM 在传输层运行,那么您可能需要担心路由器对其有特殊支持。相反,UFTP 严格运行在应用层。

关于sockets - 可靠的多播库 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31383832/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com