Thread: Hostname/IP Resolution

  1. #1
    Registered User
    Join Date
    Oct 2003

    Question Hostname/IP Resolution

    Hi ... i've just noticed something which has me a little confused.

    I am working on a client/server program at the moment and i am calling WSAAsyncGetHostByName() to resolve the server address on the client.

    But, when i give an IP address as the 3rd argument ... it still resolves the IP and connects fine ....

    So, im wondering, why, if WSAAsyncGetHostByName can resolve an IP Address, winsock also has a function for this (WSAAsyncGetHostByAddr)

    What's the difference between these two functions and should WSAAsyncGetHostByName() resolve an IP Address ?

    Thanks in advance, Thunder

  2. #2
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    I think you have missunderstood IP resolution. The only reason IP resolutions exist is to make people's life easier by not making them remember a buch of number, so they learn a word, which they can use to connect to the server. When you input an IP address, you don't need to resolve it, and the WSAAsyncGetHostByName() function probably has a defined behaviour for this.
    To sum up, when you input an address, it resoves it, but when it gets an IP address, it bypasses the resloving, and fills the hostent structure like it had already resoved the name.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  3. #3
    Registered User
    Join Date
    Oct 2003


    Thanks for your reply ... it makes sense now )
    I just didn't actually think about it ... hehehe

    thanks again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function to find resolution
    By Bag a Bones in forum C++ Programming
    Replies: 7
    Last Post: 01-19-2006, 12:53 PM
  2. Resolution testing for. . .
    By Waspntr in forum Windows Programming
    Replies: 6
    Last Post: 02-18-2003, 10:31 PM
  3. DOS resolution problem in Win2k
    By charisma in forum C Programming
    Replies: 2
    Last Post: 12-27-2002, 05:04 AM
  4. How to write code to change the printer resolution
    By ooosawaddee3 in forum C++ Programming
    Replies: 0
    Last Post: 07-26-2002, 06:04 PM
  5. Screen Resolution
    By C_Coder in forum A Brief History of
    Replies: 28
    Last Post: 12-21-2001, 08:01 PM