OpenBSD 4.0 man 7 ip says:

         struct sockaddr_in {
             sa_family_t    sin_family; /* address family: AF_INET */
             u_int16_t      sin_port;   /* port in network byte order */
             struct in_addr sin_addr;   /* internet address */
         };

/usr/include/netinet/in.h:

struct sockaddr_in {
        u_int8_t    sin_len;
        sa_family_t sin_family;
        in_port_t   sin_port;
        struct      in_addr sin_addr;
        int8_t      sin_zero[8];
};

No wonder my program didn't work properly and sent UDP with a nonsensical
source port when I wrote it according to the manpage and the manpage is wrong.

When I added the sin_len entry, it started to work properly.

CL<

Reply via email to