#include #include int main(int argc, char **argv) { struct sockaddr_in sa; // IPv4 struct sockaddr_in6 sa6; // IPv6 // IPv4 string to sockaddr_in (192.0.2.1 = C0:00:02:01). inet_pton(AF_INET, "192.0.2.1", &(sa.sin_addr)); // IPv6 string to sockaddr_in6. inet_pton(AF_INET6, "2001:db8:63b3:1::3490", &(sa6.sin6_addr)); return EXIT_SUCCESS; }