���}����Em9460�W��MAC? ����61922���Pע�^���� |
---|
���� |
1�� |
![]() |
��Em9460�W��MAC? ![]()
1,ÿƬ����Ψһֻ�xMAC��ַ�
2������xȡ��
|
�������� | ���� | �؏� ![]() |
zhl |
2�� |
![]() |
![]()
ÿ�K�嶼��Ψһ��MAC������ͨ�^�{�ؘʵĺ������@ȡ���磺
int GetLocalMac( char* mac ) {
int sock; struct ifreq ifr_mac; if( (sock=socket(AF_INET,SOCK_STREAM,0))<0 ) {
return -1; } memset( &ifr_mac, 0, sizeof(ifr_mac) ); strcpy( ifr_mac.ifr_name, "eth0" ); if( ioctl( sock, SIOCGIFHWADDR, &ifr_mac)<0 ) {
close( sock );
return -2; } memcpy( mac, ifr_mac.ifr_hwaddr.sa_data, 6 ); close( sock );
return 0; } |
�������� | ���� | �؏� ![]() |