Programmatically resolve LAN computer name for full name?

I am writing a C ++ application that receives the computer name of the local network as an input from the outside world (for example, \\ PCNAME123, which I can access by entering an invitation to start Windows or in the IE address bar) and should get some data based on this name, for example, calling a function with it gethostbyname().

The problem is that I need to have what I think is called (I'm new to Winsock and network programming in general, so maybe I don't have the right terminology), full name (for example, PCNAME123.domainname.net) . I tested it, it gethostbyname()works fine with this, but not with "PCNAME123" or "\\ PCNAME123".

How to get the full name of this network computer (note that this is not for the local host, but for other computers on the local network)?

+4
source share
2 answers

Can you try using GetAddrInfoW to get name information.

+1
source

To answer my own question, it seems like one solution is to use a function getaddrinfo().

+1
source

All Articles