Results 1 to 3 of 3

Thread: gethostbyaddr method in WSOCK32.DLL

  1. #1
    Guest

    Post

    I need some assistance with some visual basic code I am trying to implement. I am trying to call a Winsock method (gethostbyaddr). I want to pass it the variable "IP_Address" and extract the data that the method should return. I have built my data structure (TYPE hostent) but do not know how to return data into that structure. Can you point me in the right direction or give me a resource? Thanks.

    ------------------
    Jeffrey S. Russell

  2. #2
    Guest

    Post

    Not really helpful. I have plenty of "C" code to look at, but not to worry. I finally figured out how to get the function to work. Thanks anyhow for the assist!

  3. #3

    Post

    Here's some C-Code, translating it should be that hard. Hope that helps,

    -----------------------------------------------------------------
    long ip;
    ip = inet_addr("YourComputerName");

    HOSTENT *ho = gethostbyaddr((char *)&ip, 4, AF_INET);

    if (ho == NULL)
    {
    printf("Host not found.\n");
    return;
    }


    printf("%s\n", ho->h_name);

    -----------------------------------------------------------------
    regards,

    Björn

    ------------------
    EMAIL: [email protected]

    PAGE: <A HREF="http://members.xoom.com/sharetools
    " TARGET=_blank>http://members.xoom.com/sharetools
    </A>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width