diff --git a/main.c b/main.c index b903e9d..0e888c3 100644 --- a/main.c +++ b/main.c @@ -38,7 +38,7 @@ typedef struct addrinfo { Socket address info - sa_family: AF_XX (e.g AF_INET) -- sa_data: 14 bytes of protocol address +- sa_data: 14 bytes of protocol address, the destination address as well as the port number */ typedef struct sockaddr { unsigned short sa_family; @@ -47,14 +47,27 @@ typedef struct sockaddr { } sockaddr; +/* +Socket Adress Internet (ipv4) +This struct is used to replace sockaddr in instances where family = AF_INET + +- sin_family: AF_INET (ALWAYS) +- sin_port: port +- sin_addr: address struct +- sin_zero: padding to match sockaddr +*/ typedef sockaddr_in { short int sin_family; unsigned short int sin_port; - struct in_addr sin_addr; + in_addr sin_addr; unsigned char sin_zero[8]; } sockaddr_in; +typedef struct in_addr { + uint32_t s_addr; +} in_addr; + int main() {