问题
I have a Linux machine that is connected (by external NICs) to 2 external domains. I want to get the names of the domains my machine is connected to programmatically using C++. How can I get all these names in my application?
By the way, I have already tried getnameinfo
, and it doesn't work for me. So please suggest another answer.
Also, it would be more helpful to me if your answers included sample code.
回答1:
Here is similar topic Linux / C++: Get the IP Address of local computer
来源:https://stackoverflow.com/questions/4704612/can-i-get-the-names-of-all-the-domains-a-linux-computer-is-connected-to-in-c