× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



If anyone's interested in a code snippet that supports IPV4 and IPV6 then here's a C version.
There's a fully working version in our Free Utilities download on our web site "http://arpeggiosoftware.com/index.php/trials-and-free-downloads";

int addrLen, maxLen, rc;
char ipAddrBuffer[64];
struct sockaddr_in sa;
struct sockaddr_in6 sa6;
struct sockaddr *saPtr;
char hostName[1025];

do { // For break.
memset (&sa, 0x00, sizeof(sa));
rc=inet_pton(AF_INET, ipAddrBuffer, &(sa.sin_addr));
if (!rc) {
memset (&sa6, 0x00, sizeof(sa6));
rc=inet_pton(AF_INET6, ipAddrBuffer, &(sa6.sin6_addr));
if (rc!=1)
// Invalid IP address.
break;
saPtr=(struct sockaddr *)&sa6;
addrLen=sizeof(sa6);
sa6.sin6_family = AF_INET6;
} else {
saPtr=(struct sockaddr *)&sa;
addrLen=sizeof(sa);
sa.sin_family = AF_INET;
}
if (rc==1) {
if (rc=getnameinfo(saPtr, addrLen, hostName, sizeof(hostName), NULL, 0, NI_NAMEREQD)) {
// Could not get host name.
break;
}
ec=0;
} else {
// Not sure we should ever get here...
break;
}
}
} while(0);
if (ec==0) {
// Got the name in hostName
}


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.