Programmation Avancée en C


check_sockaddr_size.c

00001 #include <stdio.h>     
00002 #include <stdlib.h>
00003 #include <sys/socket.h>
00004 #include <netinet/in.h>
00005 #include <sys/un.h>
00006 
00007 int main( int argc, char* argv[]) {
00008     printf("sizeof(struct sockaddr)         = %lu\n", (unsigned long) sizeof(struct sockaddr));
00009     printf("sizeof(struct sockaddr_in)      = %lu\n", (unsigned long) sizeof(struct sockaddr_in));
00010     printf("sizeof(struct sockaddr_in6)     = %lu\n", (unsigned long) sizeof(struct sockaddr_in6));
00011     printf("sizeof(struct sockaddr_un)      = %lu\n", (unsigned long) sizeof(struct sockaddr_un));
00012     printf("sizeof(struct sockaddr_storage) = %lu\n", (unsigned long) sizeof(struct sockaddr_storage));
00013     return EXIT_SUCCESS;
00014 }
00015