I am looking for some method to obtain my laptop local IP address (eg. 192.168.1.x )using boost::asio. Via google, I only reached SJI's answer.
I am just wondering whether there are some other better options, as I think the SJI's solution might be inefficient. In order to get local IP address, SJI's solution has to set up a connected socket with remote server (google), and then obtains local_address
from the connected socket.
- Is there any other way to get local IP without setup connection with remote server using boost::asio. In many times, no public network access for me.
- Can SJI's method also work for local network (i.e., my laptop is in a local network without public Internet access), and returns the local IP address (i.e., 192.168.1.X ) instead of ISP's IP address?
Thanks