Hello,
I am trying to write a simple C program for ip lookup.
Result now points to a struct wich holds the results of my lookup, but struct addrinfo itself contains a pointer to a struct of type sockaddr_in. So i have a pointer to a pointer to a struct ... How would you get the address from that?
I am trying to write a simple C program for ip lookup.
Result now points to a struct wich holds the results of my lookup, but struct addrinfo itself contains a pointer to a struct of type sockaddr_in. So i have a pointer to a pointer to a struct ... How would you get the address from that?
Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
int status = 0;
struct addrinfo hints *p,*result;
memset(&hints,0,sizeof hints);
hints.ai_family = AF_INET;
hints.ai_socktype = SOCKSTREAM;
status = getaddrinfo("www.freebsd.org",NULL,&hints,&result);
}