Is there built-in windows C++ function call that can get hostname and IP address? Thanks.
Is there built-in windows C++ function call that can get hostname and IP address?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To get the hostname you can use: gethostname or the async method WSAAsyncGetHostByName
To get the address info, you can use: getaddrinfo or the unicode version GetAddrInfoW
You can get more information about the computer name like the domain by using the Win32 API: GetComputerNameEx.