Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 266639 Details for
Bug 285576
media-sound/mpd-0.16: port not opened when bind_to_address is set
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
getaddrinfo.c
getaddrinfo.c (text/plain), 1.31 KB, created by
SpanKY
on 2011-03-20 21:02:29 UTC
(
hide
)
Description:
getaddrinfo.c
Filename:
MIME Type:
Creator:
SpanKY
Created:
2011-03-20 21:02:29 UTC
Size:
1.31 KB
patch
obsolete
>#include <string.h> >#include <stdio.h> >#include <errno.h> >#include <sys/types.h> >#include <sys/socket.h> >#include <netdb.h> >#include <arpa/inet.h> > >int main(int argc, char *argv[]) >{ >int i, port = 6600; > > printf("family: IPv4:%i IPv6:%i\n", PF_INET, PF_INET6); > printf("proto: TCP:%i\n", IPPROTO_TCP); > >for (i = 1; i < argc; ++i) { >char *hostname = argv[i]; > > struct addrinfo hints; > memset(&hints, 0, sizeof(hints)); > hints.ai_flags = AI_PASSIVE; > hints.ai_family = PF_UNSPEC; > hints.ai_socktype = SOCK_STREAM; > hints.ai_protocol = IPPROTO_TCP; > > char service[20]; > snprintf(service, sizeof(service), "%u", port); > > struct addrinfo *ai; > int ret = getaddrinfo(hostname, service, &hints, &ai); > if (ret != 0) { > perror("getaddrinfo"); > return 1; > } > > for (const struct addrinfo *i = ai; i != NULL; i = i->ai_next) { > struct sockaddr_in *sin = (void *)i->ai_addr; > struct sockaddr_in6 *sin6 = (void *)i->ai_addr; > char buf[256]; > void *src; > > src = (i->ai_family == PF_INET) ? > (void *)&sin->sin_addr : > (void *)&sin6->sin6_addr; > > printf("------ %s --------\n", hostname); > printf("addr: %s canonname:%s\n", > inet_ntop(i->ai_family, src, buf, 256), > i->ai_canonname); > printf("flags:%#x family:%i socktype:%i proto:%i\n", > i->ai_flags, i->ai_family, i->ai_socktype, i->ai_protocol); > } > > freeaddrinfo(ai); >} > >return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 285576
:
204608
|
233321
|
265157
| 266639