mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 04:08:47 +00:00
test_getaddrinfo: also print port information
This commit is contained in:
parent
6c029fdf47
commit
3721f7e144
@ -32,8 +32,11 @@ static int doit(const char* host, const char* service) {
|
|||||||
fprintf(stderr, "error in getnameinfo: %s\n", gai_strerror(error));
|
fprintf(stderr, "error in getnameinfo: %s\n", gai_strerror(error));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*hostname != '\0')
|
int port = 0;
|
||||||
printf("hostname: %s\n", hostname);
|
if(res->ai_family == AF_INET) port = ((struct sockaddr_in*)res->ai_addr)->sin_port;
|
||||||
|
else if(res->ai_family == AF_INET6) port = ((struct sockaddr_in6*)res->ai_addr)->sin6_port;
|
||||||
|
port = ntohs(port);
|
||||||
|
printf("hostname: %s, port: %d\n", hostname, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
|
Loading…
Reference in New Issue
Block a user