Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Print the IP of the DNS lookup

  • Loading branch information...
commit 5cdff3e8598105762cf6cd0b787a1aa04d5b2e1b 1 parent 2227166
@nddrylliog authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/uv-test.c
View
5 src/uv-test.c
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.