Click to See Complete Forum and Search --> : (WIN32) (Network) computer-name alternatives


bg_programmer
March 9th, 2005, 08:37 AM
Hello.
I would be grateful to be given a hint how to retrieve *ALL* possible names of the ``localhost''. This I want to happen on a WIN32 platform (I prefer not to bind the code with the specific version of Windows, if possible). The following alternatives I am aware of, though I don't know how to retrieve (4) and (5):

1. ``localhost''
2. ``127.0.0.1"
3. the computer name, e.g. ``crap''
4. the fully qualified computer name (depending on type of local [or other type] network), e.g. ``crap.mediator-server.blabla.org''
5. the resolved IP address of (4) and (5) (which IPs must be same, as far as I know, and I know almost nothing), e.g. ``192.168.17.66''

First, I suppose there can be another alternatives which combine with (or replace) some of those above (I am in LAN with Workgroup network interface and I have no clue how the things look like in a domain, neither I have ever worked in a network under the different OS but Windows). Second, I know how to get the computer name and some siblings of it:

Using ``GetComputerNameEx()'' with every possible query-type specified returns to me just <small> and <BIG> versions of my short computer name, e.g. ``crap'' and ``CRAP''.

Third, the information that I humbly request to be supplied with, I need for the following purpose: In my app I need to suppress resolving of user-supplied address to connect to (I want this since it is possible the user to use dial-up connection, and when it is offline, and when the resolve-request is issued, the user will be prompted to connect with the standard Windows dialog, or, even worse, it can be not prompted and connect to the ISP silently). My app obviously uses sockets, but the catch is that the ``server'' of the service my app offers may be on the local machine as well as on the remote machine. Shortly: I want to be 100% sure that when the app needs to resolve (and then connect to the server) address, the app to be certain that the address is remote. So, if you see another way to implement this (different from this I request information for), please hint me.

Excuse me for any incorrect usage of network terms or for mis-understanding of the network-stuff at all. I would be grateful for any answer which enlights me a bit of all those matters.

Thank you for the reading.

Dimitar