ÔÚlinuxÏ »ñÈ¡±¾»úMACµØÖ·µÄº¯Êý
//»ñÈ¡±¾»úMACµØÖ·º¯ÊýQString GetLocalMac()
{
int sock_mac;
struct ifreq ifr_mac;
char mac_addr[30];
sock_mac = socket( AF_INET, SOCK_STREAM, 0 );
if( sock_mac == -1)
{
perror("create socket falise...mac\n");
return "";
}
memset(&ifr_mac,0,sizeof(ifr_mac));
strncpy(ifr_mac.ifr_name, "eth0", sizeof(ifr_mac.ifr_name)-1);
if( (ioctl( sock_mac, SIOCGIFHWADDR, &ifr_mac)) < 0)
{
printf("mac ioctl error\n");
return "";
}
sprintf(mac_addr,"%02x%02x%02x%02x%02x%02x",
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[0],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[1],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[2],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[3],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[4],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[5]);
printf("local mac:%s \n",mac_addr);
close( sock_mac );
return QString( mac_addr );
}
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
dzÎöLinuxÏÂcoreÎļþ
́Ȼ (zhanghua@eyou.net)
2006 Äê 8 ÔÂ 02 ÈÕ
µ±ÎÒÃǵijÌÐò±ÀÀ£Ê±£¬ÄÚºËÓпÉÄܰѸóÌÐòµ±Ç°ÄÚ´æÓ³Éäµ½coreÎļþÀ·½±ã³ÌÐòÔ±ÕÒµ½³ÌÐò³öÏÖÎÊÌâµÄµØ·½¡£×î³£³öÏֵģ¬¼¸ºõËùÓÐC³ÌÐòÔ±¶¼³öÏÖ¹ýµÄ´íÎó¾ÍÊÇ“¶Î´íÎó”ÁË¡£Ò²ÊÇ×îÄѲé³öÎÊÌâÔÒòµÄÒ»¸ö´íÎó¡£Ï ......
LinuxϵĶ¨Ê±Æ÷ÓÐÁ½ÖÖ£¬ÒÔÏ·ֱð½éÉÜ£º
1¡¢alarm
Èç¹û²»ÒªÇóºÜ¾«È·µÄ»°£¬ÓÃalarm()ºÍsignal()¾Í¹»ÁË
unsigned int alarm(unsigned int seconds)
º¯Êý˵Ã÷: alarm()ÓÃÀ´ÉèÖÃÐźÅSIGALRMÔÚ¾¹ý²ÎÊýsecondsÖ¸¶¨µÄÃëÊýºó´«Ë͸øÄ¿Ç°µÄ½ø³Ì¡£Èç¹û²ÎÊýsecondsΪ0£¬Ôò֮ǰÉèÖõÄÄÖÖӻᱻȡÏû£¬²¢½«Ê£ÏµÄʱ¼ä·µ»Ø¡£
·µ»ØÖµ: ......
WindowsÍê³É¶Ë¿ÚÓëLinux epoll¼¼Êõ¼ò½é
2009-09-16 09:13
WINDOWSÍê³É¶Ë¿Ú±à³Ì
1¡¢»ù±¾¸ÅÄî
2¡¢WINDOWSÍê³É¶Ë¿ÚµÄÌصã
3¡¢Íê³É¶Ë¿Ú£¨Completion Ports £©Ïà¹ØÊý¾Ý½á¹¹ºÍ´´½¨
4¡¢Íê³É¶Ë¿ÚÏ̵߳Ť×÷ÔÀí
5¡¢WindowsÍê³É¶Ë¿ÚµÄʵÀý´úÂë
LinuxµÄEPollÄ£ÐÍ
1¡¢ÎªÊ²Ã´selectÂäºó
2¡¢ÄÚºËÖÐÌá¸ßI/OÐÔÄܵÄз½·¨epoll
3 ......