On 9/24/19, Vinnie Falco
On Sun, Sep 22, 2019 at 5:00 PM JH via Boost
wrote: socket.bind(boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 12345));
Sorry, let me clarify it, it is in client side I want to bind a client local IP address either WiFi or other network interface.
You are using the right function, but you are passing a default-constructed IPv4 address. Why not just pass the local IP address you want to bind to (instead of 0.0.0.0, which is what a default-constructed address gives you). Look at the type of the endpoint parameter in the call to bind:
Did you refer to use boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(wifi_ip_address), portNumber)? I think you were talking about server side of default 0.0.0.0, it was my fault not being clear. Anyway, can it be done to bind client side interface IP address such as WiFi IP address? Is it possible to specify local IP address in boost::asio::ip::tcp::resolver::query query(remoteServerIpAddress, portNumber) ? Thank you Vinnie, Kind Regards, - jh