I have 3 network interfaces on a PC, and I want to make sure that when I do udp socket send, it is sent through a specific network interface (I have an IP address to use when sending data).
Here is the code.
udp::socket send_socket(io_service,boost::asio::ip::udp::v6()); udp::endpoint local_end_point(boost::asio::ip::address::from_string(LocalIpAddress),1111);
The above code works, but I do not control through which network interface the data will be sent. If I uncomment the send_socket.bind line, I stop receiving any data at the other end.
Is there any other way to bind a socket to a specific network interface?
source share