English 中文(简体)
• 如何从多台广播边际接收?
原标题:How to Receive from Multiple Multicast Remote Interfaces?

I am using Boost::asio for the following.

我正试图从多种广播渠道接收包裹。 然而,我在努力做到这一点方面遇到很大困难。 目前,我只能听从第一频道。

我的法典如下:

// create a list of endpoints for each channel

endpoint_list.push_back(new boost::asio::ip::udp::endpoint( (boost::asio::ip::address::from_string(boost::get<1>(interfaces_list[i]))).to_v4(), boost::get<2>(interfaces_list[i])));

// create a list of join_groups for each channel

join_group_list.push_back(new boost::asio::ip::multicast::join_group( (boost::asio::ip::address::from_string(boost::get<1>(interfaces_list[i]))).to_v4(),   (boost::asio::ip::address::from_string(boost::get<0>(interfaces_list[i]))).to_v4() ) );

//initiate options on each channel

socket_list[i]->open(endpoint_list[i]->protocol());     socket_list[i]->set_option(boost::asio::ip::udp::socket::reuse_address(true));
socket_list[i]->bind(*endpoint_list[i]);
socket_list[i]->set_option(*join_group_list[i]);

// callback on each socket

socket_list[i]->async_receive_from(boost::asio::buffer(buffer_array_list[i], max_length), sender_endpoint_, boost::bind(&PacketLogger::HandleReceiveFrom, this, i, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));

As you can see, each channel has their own sockets and such. I have 3 pieces of information: local interface/remote interface/remote port, all of which are correct because I can listen perfectly fine on the first channel.

是否有任何人对什么可能是错误的的想法?

Thank.

问题回答

如果你有两部订阅书,这两部书记本会相互矛盾,那么,IP的多播种管理就在东道一级,而不是在表层。

例如,你可以通过IP_加入一个只派人参加的群体。 MultyICAST_IF, 后来对该机器没有应用,因此无法同意该组的任何数据。

开始在第三方申请中尝试订阅,或者相反可能采用某些基本C法典。





相关问题
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?

热门标签