First off, it still isn’t a very complete sample of code (For example, if you get an error, gai_strerror(errnum) will show you nothing. Additionally, you never showed us the definition of SERVER_PORT. Additionally, you didn’t use [code] tags!).
Nevertheless, I think I can help you
. It seems to me the error is caused by the format of your /etc/hosts entry. The entry format is supposed to be (at least on linux, *BSD, and Mac):
Code:
ip_address canonical_hostname aliases
For example:
Code:
::1 localhost loopback
So your entry should be changed to something like:
Code:
fe80::214:4fff:fe61:3da6 dhoomsolaris
If it is still failing, you might have a problem with your numerical service (IIRC, you were previously using a numerical service). To circumvent this, you tell the resolver explicitly that you don’t need your service to be translated numerically. E.g.,
Code:
#define SERVER_PORT "80"
memset (&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG | AI_NUMERICSERV;
hints.ai_socktype = SOCK_STREAM;
int errnum = getaddrinfo ("dhoomsolaris", SERVER_PORT, &hints, &res);
if (errnum)
fprintf(stderr, "Name Resolution Failure: %s\n", gai_strerror(errnum));