Understanding struct sockaddr

后端 未结 2 1710
清酒与你
清酒与你 2020-12-14 02:11
struct sockaddr {
    unsigned short sa_family;   // address family, AF_xxx
    char           sa_data[14]; // 14 bytes of protocol address
};

In t

2条回答
  •  孤街浪徒
    2020-12-14 02:39

    I found this out when trying to duplicate the jnetpcap getHardwareAddress() method in C/C++. The MAC address is contained, when sa_family is 17 (0x11, AF_PACKET), in bytes 10-15.

提交回复
热议问题