"Linux Network Programming" Network IP address structure

Source: Internet
Author: User

  (1) The IPV4 socket address structure is also commonly referred to as the "Internetwork Sockets address Structure", which is named "Sockaddr_in", and the
        is defined in the <netinet/in.h>
        struct sockaddr_in{
            uint8_t Sin_len;//Entire Sock Addr_in structure length
            sa_family sin_family;//Specify this address family, which must be set to Af_inet
  & nbsp         in_port_t Sin_port; Port
            struct in_addr sin_addr//piv4 address
            Char sin_sero[8]; Temporarily unused, typically set to 0
       };

  (2) Generic address structure to specify the address associated with the socket
       struct sockaddr{
           uint8_t Sin_len; Length of the entire SOCKADDR structure
           sa_family sin_family;//Specify this address family
      & nbsp    char sa_data[14]; Determined by the sin_famly its form
       };

Linux Network Programming network IP address structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.