Boost logo

Boost Users :

Subject: [Boost-users] multiple or single joins on asio socket
From: Lee MacDonald (lee.macdonald_at_[hidden])
Date: 2009-10-22 05:42:27


Guys,
 
I have a application running on Linux using boost 1.35, that receives
packets to several different multicast addresses, but on the same port
and interface. For each different multicast address I perform the
following:
 
// create a new socket
socket_(ioService)

// set the listen end point to that of the multicast address and port

boost::asio::ip::udp::endpoint listenEndPoint(multicastAddress.to_v4(),
port);

// we need to be able to reuse the underlyling socket created as more
than one asio socket will share it.

socket_.set_option(boost::asio::ip::udp::socket::reuse_address(true));

socket_.bind(listenEndPoint);

// perform the actual join to the multicast group

socket_.set_option(boost::asio::ip::multicast::join_group(destAddress.to
_v4(), interfaceAddress.to_v4()));

So I bind to a seperate asio socket instance for each multicast address
and then perform a join to that address, hence each asio socket only has
a single join associated with it.
 
Is a better approach to have a single asio socket instance and perform a
join for each multicast address that shares the port & interface? If
so, how would I set listenEndPoint? Is there any performance differences
between the two? Are there better approaches?
 
Thanks.
 
Lee MacDonald
 

 
Schneider Trading
4th Floor,
25 Copthall Avenue
London EC2R 7BP

--------------------------------------------------------

Message from: lee.macdonald_at_[hidden]
Message to: boost-users_at_[hidden]
Attached files: 0
This e-mail and any files transmitted with it are confidential, may be legally privileged, and are for the sole use of the intended recipient. Copyright in this e-mail and any accompanying document created by us is owned by us. If you are not the intended recipient of this e-mail or any part of it please telephone our IT Department at the number shown above or by e-mail at info_at_schneidertrading.com.
You should not use or disclose to any other person the contents of this e-mail or its attachments (if any), nor take copies. This e-mail is not a representation or warranty and is not intended nor should it be taken to create any legal relations, contractual or otherwise.
Schneider Trading Associates Ltd (Registration No. 3692131) is incorporated in England and Wales and the registered office is at 25 Copthall Avenue, London EC2R 7BP. The company is authorised and regulated by the Financial Services Authority



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