Hiya guys,

Been doing some network socket programming and came across something I can't quite figure out.

We have a sockaddr_in struct that has the following members:

        uint8_t         sin_len
        sa_family_t     sin_family
        in_port_t       sin_port
        struct in_addr  sin_addr
        char            sin_zero

Question I have: why is in_addr a struct onto itself? The in_addr struct only has one members as far as I can tell:

        in_addr_t       s_addr

Why couldn't the sockaddr_in struct contain a member def. like this:

        in_addr_t       sin_addr

If in_addr had more than one member I could understand it. But since it only has one, it doesn't make much sense to me.

It's probably something elemental to seasoned programmers. Anybody care to explain? :)
        

--
Gerard Beekmans

/* If Linux doesn't have the solution, you have the wrong problem */

--
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to