Boost logo

Boost Users :

Subject: Re: [Boost-users] udp with virtual network cards
From: Gianni Ambrosio (gianni.ambrosio_at_[hidden])
Date: 2012-04-04 03:31:41

Il 3/28/2012 8:24 PM, Jim Bell ha scritto:
> On 3/28/2012 7:41 AM, Gianni Ambrosio wrote:
>> I mean the network adapter created by a virtualization tool (like
>> VMware).
>> I verified that a client on win7 with a such network adapter active
>> does not work (I'm talking about udp multicast, while TCP works
>> perfectly). On the other side if I disable the "real" card and then
>> enable it again, udp starts magically working.
>> Any idea?
> I don't have a link for this, but I know well that, on a Windows
> machine with more than one NIC (network adapter), outgoing broadcast
> messages have the FIRST network adapter's address as the return
> address on messages going out all NICs. The receiver on the second
> network uses that (wrong) address for the response, and the response
> doesn't get back to the PC. Disabling and enabling may switch which
> NIC is considered first (not sure about that).
> I've seen this on Windows XP but haven't tried to repeat it on Windows
> 7. The problem is in the OS.

Dear All,
I found that the IP address of the network interface of the client used
for the socket connection would be enough to solve the problem.
Now, is there a way to get that IP address? I also use a TCP socket
connection before starting the UDP multicast. Is there a way to get the
IP related to the network card connected to the TCP socket?

Here is my actual code. I need to find a way to get the IP
"" that is the address of the network card of client (that
calls receiveFrom() method)

void BoostUdpSocketMulticast::receiveFrom(const std::string&
iMulticastAddress, const unsigned short iMulticastPort)
    boost::system::error_code error;
    boost::asio::ip::address_v4 m_address =
boost::asio::ip::address_v4::from_string(iMulticastAddress, error);
    boost::asio::ip::address_v4 l_address =
boost::asio::ip::address_v4::from_string("", error);
    endpoint=boost::asio::ip::udp::endpoint(l_address, iMulticastPort);;
    // join the multicast group on a specific interface
    boost::asio::ip::multicast::join_group option(m_address,l_address);


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at