문제

Possible Duplicate:
Get the IP Address of local computer

I want to be able to get the IP address for the machine I'm on in C++ without querying external www.whatsmyip.com, but also want to do it in a platform-independent way. I can find specific examples for both Windows and Linux, but can't think of an easy way to do this in a platform-independent way. I would also consider options of putting an if-statement in depending on the Operating System if this seems like the best/only method.

도움이 되었습니까?

해결책

If you are able to use boost, I highly recommend the boost::asio, which is about as cross-platform as you're going to get.

다른 팁

An alternative to boost::asio may be the POCO Network Library.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top