简体   繁体   English

boost :: asio组播示例

[英]boost::asio multicast example

I've just began reading information about multicast transfers using boost::asio and I'm somewhat puzzled by the following: 我刚刚开始使用boost :: asio读取有关多播传输的信息,我对以下内容感到有些困惑:

Why do we need a "listening address" in the following boost::asio example? 为什么我们需要在下面的boost :: asio示例中使用“监听地址”? What's the point of that? 那是什么意思? Why would one choose anything different than localhost? 为什么选择与localhost不同的东西?

http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/example/multicast/receiver.cpp http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/example/multicast/receiver.cpp

如果有多个网络接口卡(每个NIC绑定到不同的IP地址),则必须指定侦听IP地址。

In your apartment... 在你的公寓里......

When you're working at home on your laptop, you probably don't care. 当您在家中使用笔记本电脑工作时,您可能并不在意。 The primary goal is usually to connect anything to everything it wants to within your machine, in which case localhost is just fine. 主要目标通常是将任何东西连接到机器中的所有内容,在这种情况下, localhost就可以了。

... but servers do care! ......但服务器确实关心!

High-end servers, on the other hand, usually have more than one network card . 另一方面,高端服务器通常具有多个网卡 Even better, high-performance network cards often have more than one physical plug, and both of them may be active with different DHCP leases. 更好的是,高性能网卡通常具有多个物理插头,并且它们都可以在具有不同DHCP租约的情况下处于活动状态。

Servers will also often be part of public and private networks , which may or may not include a VPN which has its own subnet and accessibility parameters. 服务器通常也是公共和专用网络的一部分 ,其可能包括也可能不包括具有其自己的子网和可访问性参数的VPN Sysadmins think about these addresses a lot, and they care deeply about which particular address each service is available. 系统管理员会仔细考虑这些地址,并且他们非常关心每个服务可用的特定地址。 Is it a private service? 这是私人服务吗? Is there an untrusted subnet that shouldn't be making these requests? 是否有不受信任的子网不应该发出这些请求?

These questions span both security and system organization concerns. 这些问题涉及安全和系统组织问题。 It's not specific to multicast: the UNIX bind system call also takes a specific address for all of the above reasons. 它不是特定于多播:由于上述所有原因,UNIX bind系统调用也采用特定地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM