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 Ê ......
1£®¹ØÓÚÎļþ/Ŀ¼´¦ÀíµÄÖ¸Áî
1.1 ls Ö¸Áî
lsµÄÒâÒåΪ“list”£¬Ò²¾ÍÊǽ«Ä³Ò»¸öĿ¼ÏµÄÄÚÈÝÏÔʾ³öÀ´¡£
lsÓÐһЩ²ÎÊý£¬¿ÉÒÔ¸øÓèʹÓÃÕ߸ü¶àÓйصÄ×ÊѶ£¬ÈçÏ£º
-a£ºÔÚlinuxÖÐÈôÒ»¸öĿ¼»òÎļþÃû×ֵĵÚÒ»¸ö×ÖԪΪ“.”£¬ÔòʹÓÃls½«²»»áÏÔʾ³öÕâ¸öÎļþµÄÃû×Ö£¬ÎÒÃdzƴËÀàÎļþΪÒþ²ØÎļþ¡£Èç¹ûÎÒà ......
linuxÏÂĬÈÏÖ»ÄܽâѹzipѹËõÎļþ£¬¶ørarÎļþĬÈÏûÓнâѹ֧³ÖµÄ¹¤¾ß£¬ÕâÀïÌṩһ¸ö¼òµ¥µÄ·½Ê½£¬°²×°rar¹¤¾ß£¬Ö§³ÖlinuxϽâѹrarÎļþ¡£
1£ºÊ×ÏÈÏÂÔØrar½âѹ¹¤¾ß£¬ÕâÀïÓà rarlinux-3.6.b6.tar.gz£¬¸ø³öÒ»¸öÍøÓÑÌṩµÄ°æ±¾ÏÂÔØµØÖ·£º
http://blogimg.chinaunix.net/blog/upfile2/080226173046.gz
2£º½ÓÏÂÀ´Ö´ÐÐÈçϲÙ×÷
t ......
sudoÊÇlinuxϳ£ÓõÄÔÊÐíÆÕͨÓû§Ê¹Ó󬼶Óû§È¨Ï޵Ť¾ß¡£
ËüµÄÖ÷ÒªÅäÖÃÎļþÊÇsudoers,linuxÏÂͨ³£ÔÚ/etcĿ¼Ï£¬Èç¹ûÊÇsolaris£¬È±Ê¡²»×°sudoµÄ£¬±àÒë°²×°ºóͨ³£ÔÚ°²×°Ä¿Â¼µÄ etcĿ¼Ï£¬²»¹ý²»¹ÜsudoersÎļþÔÚÄĶù£¬sudo¶¼ÌṩÁËÒ»¸ö±à¼¸ÃÎļþµÄÃüÁvisudoÀ´¶Ô¸ÃÎļþ½øÐÐÐ޸ġ£Ç¿ÁÒÍÆ¼öʹÓøÃÃüÁîÐÞ¸Ä sudoers£¬ÒòΪ ......
1)¹Ø±Õ·À»ðǽ
#service iptables stop<enter> \\¹Ø±Õ·À»ðǽ
#chkconfig iptables off<enter> \\¹Ø±Õ¿ª»úÆô¶¯
2)IPµØÖ·µÄÅäÖÃ
¢ÙÃüÁʽ
#netconfig<enter> \\ÉèÖÃIPµØÖ·¡¢×ÓÍøÑÚÂë¡¢Íø¹Ø¡¢DNS
#vi /etc/sysconfig/network \\Ö÷»úÃû
#hostname XXX \\ÉèÖÃÖ÷»úÃû³Æ
#exit ......