1 struct in_addr{ 2 in_addr_t s_addr; 3 }; 4 struct sockaddr_in{ 5 uint8_t sin_len; 6 sa_family_t sin_family; 7 in_port_t sin_port; 8 9 struct in_addr sin_addr; 10 char sin_zero[8]; 11 };
struct sockaddr{ uint8_t sa_len; sa_family_t sa_family; char sa_data[14]; }; int bind(int ,struct sockaddr *,socklen_t); strcut sockaddr_in serv; bind(sockfd,(struct sockaddr *)&serv,sizeof(serv));
struct sockaddr_in serv; connect(sockfd,(SA *)&serv,sizeof(serv));
struct sockaddr_un cli; socklen_t len; len = sizeof(cil); getpeername(unixfd,(SA *)&cli,&len);
1 int main(int argc,char ** argv){ 2 union{ shot s; 3 char c[sizeof(short)]; 4 }un; 5 un.s = 0x0102; 6 printf("%s:",CPU_VENDOR_OS); 7 if(sizeof(short) ==2){ 8 if(un.c[0]==1 && un.c[1]==2) 9 printf("big-endian\n"); 10 else if(un.c[0]==2 && un.c[1]==1) 11 printf("little-endian\n"); 12 else 13 printf("unknown\n"); 14 }else{ 15 printf("sizeof(short) = %d\n",sizeof(short)); 16 } 17 exit(0); 18 }