Boost logo

Boost Users :

Subject: Re: [Boost-users] Asio and software interrupts
From: Steve Lorimer (steve.lorimer_at_[hidden])
Date: 2012-12-03 18:17:33


On 4 December 2012 01:51, Joseph Sulewski <joemacher_at_[hidden]> wrote:

> *When I call socket->bind I provide it with an endpoint. When I create
> the endpoint I'm currently using the multicast address, what should I use
> for the address? *
>
If you bind to INADDR_ANY then the OS will use its ip routing tables to
work out which the best local nic to use is. You can force it to use a
specific local nic by providing its address. Most applications will
use INADDR_ANY

*If I'm binding to multiple multicast addresses it doesn't make sense to
> bind to one of them.*
>
Because UDP is connectionless there is no way for the kernel / network
stack to know which pid to deliver datagrams to for a particular port
unless you bind your socket's file descriptor to that port.
(note, if you want to allow other file descriptors to be able to bind to
that port you need to set SO_REUSEADDR to 1)

> *Finally, it appears I can join multiple multicast groups but they need
> to be the same port. Is this correct?*
>
The reason for this is as my previous point above. What you would do is
create as many sockets as there are different ports, and have each socket
join the multicast addresses which are on that port

>
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net