PDA

Click to See Complete Forum and Search --> : gethostbyaddr method in WSOCK32.DLL


Dec 14th, 1999, 12:49 AM
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

Dec 16th, 1999, 02:49 AM
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!

Björn
Dec 16th, 1999, 11:39 AM
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: shareware@lycosmail.com

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