[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 02503) about source address
- To: <usagi-users@xxxxxxxxxxxxxx>
- Subject: (usagi-users 02503) about source address
- From: "Su Po-chou" <supc@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Aug 2003 04:44:38 +0800
- References: <1059565598.27394.11.camel@vimes.crl.hpl.hp.com>
- Reply-to: usagi-users@xxxxxxxxxxxxxx
Hi all,
I am writing a socket programming about source addresses selection
But no matter how I am trying, it just can print out ::1
How to get my source addresses like this 3ffe:3600:1a:1::1234 ?
My platform is Red Hat 8.0
Thanks for suggestions.
PC
below is part of my source
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6;
hints.ai_socktype = SOCK_STREAM;
if (getaddrinfo(hostname,servname,&hints, &res) == 0) {
while (res != NULL) {
if (getnameinfo(res->ai_addr, res->ai_addrlen, myaddrbuf, NI_MAXHOST,NULL,
0,NI_NUMERICHOST) != 0) {
printf("error with getnameinfo\n");
} else {
printf("myaddrbuf: %s\n", myaddrbuf);
} //end switch
res = res->ai_next;
} //while