linuxÍøÂç±à³Ì
ÍøÂç³ÌÐòºÍÆÕͨ³ÌÐò×î´óµÄÇø±ð¾ÍÊÇ,ÍøÂç³ÌÐòÊÇÓÉÁ½²¿·Ö×é³ÉµÄ--server/client.Ò»°ãÇé¿öÏÂ,ÊÇÏÈÔËÐÐserver¶ËÉϵijÌÐò,È»ºóµÈ´ýclient¶ËÉϵijÌÐòÔËÐв¢½¨Á¢Á¬½Ó,server¶ËÉϵijÌÐòÔÚÒ»¸ö¶Ë¿Ú¼àÌý,µÈ´ýclient¶Ë·¢À´µÄÇëÇó.
int socket(int domain,int type,int protocol)
domain:˵Ã÷ͨѶ³ÌÐòËùÔÚÖ÷»úËù²ÉÓõÄͨѶÐÒéÀà(AF_INETºÍAF_UNIXµÈ);AF_UNIXÖ»ÄÜÓÃÓÚµ¥Ò»µÄUNIXϵͳ½ø³Ì¼äͨѶ,AF_INETÊÇÕë¶ÔinternetµÄ,¿ÉÒÔÓÃÓÚÔ¶³ÌÖ÷»ú¼äµÄͨѶ;
type:ÍøÂç³ÌÐòËù²ÉÈ¡µÄͨѶÐÒé(SOCK_STREAMºÍSOCK_DGRAM);
protocl:Ëù²ÉÈ¡µÄÐÒé,Ò»°ãÉèÖÃΪ0¾Í¿ÉÒÔÁË,Ö÷»ú»á×Ô¶¯Ñ¡ÔñºÏÊʵÄÐÒé.
int bind(int sockfd,struct sockaddr * myaddr,int addrlen)
sockfd:ÊÇsocketµÄ·µ»ØµÄÎļþÃèÊö·û,ÓÃÓÚ¼àÌýµÄsocket;
addrlen:ÊÇsockaddr½á¹¹µÄ³¤¶È;
myaddr:ÊÇÒ»¸öÖ¸ÏòsockaddrµÄ½á¹¹ÌåµÄÖ¸Õë;
¶ÔÓÚsockaddr½á¹¹ÌåµÄ¶¨Òå:
struct sockaddr
{
unsigned short as_family;
char as_data[14];
}
ÓÉÓÚϵͳµÄ¼æÈÝÐÔ,ÓÃÁíÍâÒ»¸ö½á¹¹ÌåÌæ´ú,sockaddr_in:
struct sockaddr_in
{
unsigned short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
unsigned char sin_zero[8];
}
sin_addrÒ»°ãÊÇÉèÖÃΪINADDR_ANY,¿ÉÒÔ½ÓÊÜÈκÎÖ÷»úµÄͨѶ,sin_portÊÇÒª¼àÌýµÄ¶Ë¿Ú,bind()½«±¾µØ¶Ë¿ÚºÍsocket°ó¶¨ÔÚÒ»Æð,³É¹¦ºó·µ»Ø0,ʧ°Üʱ·µ»Ø-1,ºÍsocket()Ò»Ñù.
int listen(int sockfd,int queuelen)
sockfd:bind()µÄsocketÃèÊö·û,ÓÃÓÚ¼àÌýµÄsocketÃèÊö·û;
queuelen:µÈºòÅŶӵÄ×î´ó³¤¶È.listen()½«bind()µÄsocketÃèÊö·û±äΪ¼àÌýµÄÌ×½Ó×Ö,·µ»ØµÄÇé¿öºÍbind()Ò»Ñù.
int accept(int sockfd,struct sockaddr * addr,int addrlen)
sockfd:ÊÇlistenºóµÄÎļþÃèÊö·û;
addrºÍaddrlen:ÊǸøclient¶Ë³ÌÐòÌîдµÄ,·þÎñÆ÷Ö»Òª´«µÝÖ¸Õë¾Í¿ÉÒÔÁË;
bind(),listen()ºÍaccept()ÊÇ·þÎñ¶ËÓõĺ¯Êý,accept()º¯Êýµ÷ÓÃʱ,server¶Ë»áÒ»Ö±×èÈûµ½ÓÐÒ»¸öclient·¢³öÁËÁ¬½ÓÇëÇó,accept()³É¹¦Ê±·µ»Ø×îºóµÄ·þÎñÆ÷¶ËµÄÎļþÃèÊö·û,ÏÖÔÚ·þÎñÆ÷¶Ë¿ÉÒÔÏò¸ÃÃèÊö·ûдÐÅÏ¢ÁË.ʧ°Üʱ·µ»Ø-1.
int connect(int sockfd,struct sockaddr *servaddr,int addrlen)
sockfd:socket()·µ»ØµÄÎļþÃèÊö·û;
servaddr:´æ´¢ÁËserver¶ËµÄÁ¬½ÓÐÅÏ¢,ÀïÃæµÄsin_familyÊÇ·þÎñÆ÷¶ËµÄµØÖ·
addrlen:servaddrµÄ³¤¶È;
connect()ÊÇ
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
LinuxϵĿâ--ÖØÒªµÄ´úÂ븴ÓûúÖÆ¡¾×ª¡¿
2008-03-26 17:57
±¾ÎÄÖ÷Òª½â¾öÒÔϼ¸¸öÎÊÌâ
1 ΪʲôҪʹÓÿ⣿
2 ¿âµÄ·ÖÀà
3 ´´½¨×Ô¼ºµÄ¿â
»òÐí´ó¼Ò¶Ô×Ô¼º³õѧ
linuxʱµÄÇéÐÎÈÔ¼ÇÒäÓÈаɡ£Èç¹ûûÓÐÒ»¸öÄܽϺõĽâ¾öÒÀÀµ¹ØϵµÄ°ü¹ÜÀíÆ÷£¬ÔÚlinuxÏ°²×°Èí¼þ½«ÊÇÒ»¼þ¼°ÆäÍ´¿àµÄ¹¤×÷¡£Äã×°a°üʱ£¬¿ÉÄÜ»áÌáʾ
ÄãÒªÏÈ×°b°ü£¬ ......
Linux USBÇý¶¯¿ò¼Ü·ÖÎö£¨Ò»£©
³õ´Î½Ó´¥ÓëOSÏà¹ØµÄÉ豸Çý¶¯±àд£¬¸Ð¾õ»¹Í¦ÓÐÒâ˼µÄ£¬ÎªÁ˲»ÖÁÓÚÍüµô¿´¹ýµÄ¶«Î÷£¬±Ê¼Ç¸ú×ܽᵱȻ²»¿Éȱ£¬¸üºÎ¿öÎÒ¾ö¶¨ÎªÇ¶ÈëʽÂôÃüÁË¡£ºÃ£¬ÑÔ¹éÕý´«£¬ÎÒ˵һ˵Õâ¶Îʱ¼äµÄÊÕ»ñ£¬¸ú´ó¼Ò·ÖÏíÒ»ÏÂLinuxµÄÇý¶¯¿ª·¢¡£µ«Õâ´ÎÖ»ÏÈÕë¶ÔLinuxµÄUSB×Óϵͳ×÷·ÖÎö£¬ÒòΪÖÜÎåÑÐÌÖÀÏ°å´ß» ......
½ñÌì·¢Ïֺܶà³ÌÐòËÀÔÚlinux ·þÎñ½øÖÐ
ÎʸöÎÊÌâ ½ñÌì·¢Ïֺܶà³ÌÐòËÀÔÚlinux ·þÎñ½øÖÐ
ÒѾËÀÁ˺öàÌìÁË¡£ÓÃcrontab ¶¼¶¨ÔÚ Á賿0µãÅÜ¡£
ÏëÖªµÀÈçºÎ²é¿´ ·þÎñÆ÷ÄÄ·½ÃæµÄ×ÊÔ´Ì«ÉÙµ¼Ö½ø³ÌËÀÔÚÀïÃ棿
ps -ef|grep load/script | awk '{print $2}' °ÑËÀ½ø³ÌµÄ ID ´òÓ¡³öÀ´
......
To enable dumps for every daemon:
ulimit -c unlimited >/dev/null 2>&1 (-c maximum size of core files)
ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1
Dump for system
:
DAEMON_COREFILE_LIMIT='unlimited'
The same for every daemon (in /etc/sysconfig/_daemon_ ......