summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-04-01 16:32:56 +0200
committerAndreas Baumann <abaumann@yahoo.com>2009-04-01 16:32:56 +0200
commit96a92271e05acc3479b4a4b38d26c1151f0b2be6 (patch)
tree779fb281b30083857f936aac37c4b25cfcb31b06 /tests
parent1bd1e54a61633e0b538f7d13cfc5969602043014 (diff)
downloadwolfbones-96a92271e05acc3479b4a4b38d26c1151f0b2be6.tar.gz
wolfbones-96a92271e05acc3479b4a4b38d26c1151f0b2be6.tar.bz2
added retrieving service/port with getnameinfo in test_getddrinfo
Diffstat (limited to 'tests')
-rw-r--r--tests/port/test_getaddrinfo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/port/test_getaddrinfo.c b/tests/port/test_getaddrinfo.c
index e0665d3..42e28d1 100644
--- a/tests/port/test_getaddrinfo.c
+++ b/tests/port/test_getaddrinfo.c
@@ -40,9 +40,10 @@ int main( void ) {
/* loop over all returned results and do inverse lookup */
for( res = result; res != NULL; res = res->ai_next ) {
char hostname[NI_MAXHOST] = "";
+ char service[NI_MAXSERV] = "";
error = getnameinfo( res->ai_addr, res->ai_addrlen, hostname, NI_MAXHOST,
- NULL, 0,
+ service, NI_MAXSERV,
NI_NUMERICSERV | NI_NUMERICHOST );
if( error != 0 ) {
fprintf( stderr, "getnameinfo failed: %s (%d)\n",
@@ -54,7 +55,7 @@ int main( void ) {
}
if( *hostname != '\0' ) {
- printf( "%d %d %s\n", res->ai_family, res->ai_socktype, hostname );
+ printf( "Got IP %s and port %s\n", hostname, service );
}
}