Reliable Multicast Library C++
我知道这个和这个 stackoverflow 问题,它回答了实现"可靠多播"的已知方法,但最近我遇到了一些网站,其中提到甚至路由器也应该被编程来处理通过 UDP 设计的自定义协议,这是真的吗?
基本上我想对我的应用程序使用多播,我不想对更改路由器施加任何限制以配置自定义协议以可靠的方式处理 UDP,例如我正在考虑通过 UDP 实现/使用 PGM 协议处理多播,但有人说路由器也应该支持 PGM,这限制了我提供解决方案,因为客户应该为我的解决方案更改基础设施,这是没有根据的。
请告诉我是否有任何解决方案可以实现以可靠的方式处理 UDP 数据包,而无需更改网络基础设施。
提前致谢。
编辑:
我并不是说我不想在路由器中启用多播,我肯定会在路由器中启用多播路由。当我读到 PGM 实现时,有人说甚至路由器也应该支持 PGM,我认为这与商店中的市售路由器不同。我的理解有误吗?
如果您不能或不想将路由器配置为转发多播流量或以其他方式处理第三方协议,您将需要通过单播链路隧道传输多播流量。 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.
下面是一个典型配置的示意图,其中服务器向本地网络发送多播消息,一个或多个服务器代理将消息单播到相应的客户端代理,然后客户端代理又将消息多播到其本地网络。 这些代理也能够在 NATed 环境中工作: If a client proxy is behind a firewall, the proxy can send a heartbeat 我是该软件的作者,所以如果您需要有关如何设置的指导,请通过 UFTP 页面底部的链接给我发送电子邮件,我们将看看我们能做些什么。 更新: 在 PGM 的情况下,它可以配置为在应用层(即在 UDP 之上)或传输层(即直接在 IP 之上)运行。如果 PGM 在传输层运行,那么您可能需要担心路由器对其有特殊支持。相反,UFTP 严格运行在应用层。
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
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.
如果您使用多播,则需要向网络基础架构添加多播支持要求。除非在网络设备(多播路由器)上启用多播路由,否则多播将仅在一个 LAN 内可用。
通过互联网基础设施的唯一可靠方式是单播。
更新:多播路由在网络层执行,多播路由器不需要了解有关传输/应用层的任何信息。在某些情况下,网络层需要有关应用层的知识,但几乎所有这些情况都与 NAT ALG(应用级网关)有关。
顺便说一下,通过 Internet 传递多播的一种可能解决方案是隧道协议(GRE、IP over IP 等)。