Permalink
Browse files

Print the IP of the DNS lookup

  • Loading branch information...
1 parent 2227166 commit 5cdff3e8598105762cf6cd0b787a1aa04d5b2e1b Amos Wenger committed Jun 15, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/uv-test.c
View
@@ -5,6 +5,11 @@ static uv_loop_t* uv_loop;
void getaddrinfo_cb(uv_getaddrinfo_t* handle, int status, struct addrinfo* res) {
printf("DNS resolved, status = %d\n", status);
+ struct sockaddr *addr = res->ai_addr;
+ char name[1024];
+ uv_ip4_name((struct sockaddr_in *) addr, name, 1024);
+
+ printf("The IP we are looking for is %s\n", name);
}
int main(int argc, char** argv) {

0 comments on commit 5cdff3e

Please sign in to comment.