-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
udp multicast ip #200
base: master
Are you sure you want to change the base?
udp multicast ip #200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR @valt2017! I have left a few remarks which might be worth for consideration. Need to check Boost.Asio's API on socket options, but I assume it is essentially a direct mapping of setsockopt
calls.
@@ -7,18 +7,28 @@ | |||
namespace ip = boost::asio::ip; | |||
using namespace vanetza; | |||
|
|||
UdpLink::UdpLink(boost::asio::io_service& io_service, const ip::udp::endpoint& endpoint) : | |||
UdpLink::UdpLink(boost::asio::io_service& io_service, const ip::udp::endpoint& endpoint, const std::string& ip) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passing address as boost::asio::ip::address
might be beneficial
multicast_endpoint_(endpoint), | ||
tx_socket_(io_service), rx_socket_(io_service), | ||
rx_buffer_(2560, 0x00) | ||
{ | ||
tx_socket_.open(multicast_endpoint_.protocol()); | ||
|
||
if(ip.size() != 0){ | ||
boost::asio::ip::multicast::outbound_interface option(boost::asio::ip::address_v4::from_string(ip)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had a look at the ip(7) man page: I assume we can even pass the interface index instead of an IP address to outbound_interface
and join_group
. This would save us the EthernetDevice::ip
lookup call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interface index instead of IP seems reasonable, I can try it later.
Specific network interface (selected according its IP address) is used for UDP multicast.