English 中文(简体)
Boost。 Asio Bulls 在试图加入多广播集团时没有这种装置例外
原标题:Boost.Asio throws No such device exception when trying to join multicast group

Following code throws exception "No such device", when trying to join the multicast group (set_option call).

#include <boost/asio.hpp>

int main(){
    const std::string recv_addr = "232.4.130.147";
    const int recv_port = 31338;

    boost::asio::io_service io_service;
    boost::asio::ip::udp::endpoint recv_endpoint(
                boost::asio::ip::address::from_string(recv_addr),
                recv_port);
    boost::asio::ip::udp::socket recv_sock(io_service, recv_endpoint);

    recv_sock.set_option(
            boost::asio::ip::multicast::join_group(
                boost::asio::ip::address::from_string(recv_addr).to_v4()
                ));
}

不管网络-manager是否运行,都不会发生。 而没有提到IP地址。

The problem arises when I connect to an internal network with IP address manually set. On the other network, where IP is obtained from DHCP I observe no problem.

我有<代码>eth0,随时接通,这是唯一活跃的、非当地接口。

我曾尝试在上注明听话界面,但我只举一个例外情况<>Invalid case>代替>和Boostasioipmulticastjoin-group-does-not-work>。 Asio documentation 接口。

最佳回答

由于没有人种协进会,没有多播的通道。

使用:

route add -net 224.0.0.0/4 dev eth0
问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签