Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LinuxÍøÂçЭÒéÕ»(Ò»)——SocketÈëÃÅ(1)

1¡¢TCP/IP²Î¿¼Ä£ÐÍ
ΪÁËʵÏÖ¸÷ÖÖÍøÂçµÄ»¥Á¬£¬¹ú¼Ê±ê×¼»¯×éÖ¯(ISO)Öƶ¨ÁË¿ª·Åʽϵͳ»¥Á¬(OSI)²Î¿¼Ä£ÐÍ¡£¾¡¹ÜOSIµÄÌåϵ½á¹¹´ÓÀíÂÛÉϽ²ÊDZȽÏÍêÕûµÄ£¬µ«Êµ¼ÊÉÏ£¬ÍêÈ«·ûºÏOSI¸÷²ãЭÒéµÄÉÌÓòúÆ·È´ºÜÉÙ½øÈëÊг¡¡£¶øʹÓÃTCP/IP ЭÒéµÄ²úÆ·È´´óÁ¿Ó¿ÈëÊг¡£¬¼¸ºõËùÓеŤ×÷Õ¾¶¼ÅäÓÐTCP/IPЭÒ飬ʹµÃTCP/IP ³ÉΪ¼ÆËã»úÍøÂçµÄʵ¼ÊµÄ¹ú¼Ê±ê×¼¡£
2¡¢Ì×½Ó×Ö(socket)
socketÊDzÙ×÷ϵͳµÄÖØÒª×é³É²¿·ÖÖ®Ò»£¬ËüÊÇÍøÂçÓ¦ÓóÌÐòµÄ»ù´¡¡£´Ó²ã´ÎÉÏÀ´Ëµ£¬ËüλÓÚÓ¦Óò㣬ÊDzÙ×÷ϵͳΪӦÓóÌÐòÔ±ÌṩµÄAPI£¬Í¨¹ýËü£¬Ó¦ÓóÌÐò¿ÉÒÔ·ÃÎÊ´«Êä²ãЭÒé¡£
1¡¢socket λÓÚ´«Êä²ãЭÒéÖ®ÉÏ£¬ÆÁ±ÎÁ˲»Í¬ÍøÂçЭÒéÖ®¼äµÄ²îÒ죻
2¡¢socketÊÇÍøÂç±à³ÌµÄÈë¿Ú£¬ËüÌṩÁË´óÁ¿µÄϵͳµ÷Ó㬹¹³ÉÁËÍøÂç³ÌÐòµÄÖ÷Ì壻
3¡¢ÔÚLinuxϵͳÖУ¬socketÊôÓÚÎļþϵͳµÄÒ»²¿·Ö£¬ÍøÂçͨÐÅ¿ÉÒÔ±»¿´×÷ÊǶÔÎļþµÄ¶ÁÈ¡£¬Ê¹µÃÎÒÃǶÔÍøÂçµÄ¿ØÖƺͶÔÎļþµÄ¿ØÖÆÒ»Ñù·½±ã¡£
2.1¡¢Ì×½Ó×ÖµØÖ·
ÔÚ´«Êä²ãÉÏ£¬Í¨ÐŶ˵ã¿ÉÓÉInternetÉÏ3¸ö²ÎÊýÃèÊö£ºËùÓõÄЭÒé¡¢IPµØÖ·ºÍ¶Ë¿ÚºÅ¡£ÕâЩÄÚÈÝÓÉsockaddrÃèÊö£º
//usr/include/sys/socket.h
typedef unsigned short    sa_family_t;
//ͨÓÃsocketµØÖ·
struct sockaddr {
    sa_family_t    sa_family;    /* address family, AF_xxx,ЭÒé´Ø*/
    char        sa_data[14];    /* 14 bytes of protocol address    */
};
//usr/include/netinet/in.h
//INETµØÖ·´ØµÄsocketµØÖ·
struct in_addr {
                    __u32 s_addr;
};
struct sockaddr_in   {
   sa_family_t            sin_family;      /* Address family: AF_INET */
   unsigned short int     sin_port;        /* Port number,¶Ë¿Ú*/
 


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì(Áù) L2CAP±à³ÌʵÀý

ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
 Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......

תÌù£ºÊóÑÛ¿´Linuxµ÷¶ÈÆ÷ £¨2£©

ת×Ô  http://hi.baidu.com/grantzhou/blog/item/56a91cf3b685cdc90a46e09d.html
ËÄ¡¢sched_setscheduler()ϵͳµ÷Óá£
Õâ¸öϵͳµ÷Óõĵ÷Óòã´ÎºÍ´úÂ붼±Ènice¸´ÔÓЩ£¬ËùÉæ¼°µÄÒ²Óв»ÉÙÎÒÃÇÕâÀï²»¸ÐÐËȤµÄ¶«Î÷£¬Òò´Ë¾Í²»ÔÙÒÔչʾ´úÂëµÄ·½·¨½éÉÜËüÃÇÁË¡£ÕâÀï½öÔÚ¹¦Äܲã´ÎÉÏ£¬´ÓÓënice()¶Ô±ÈµÄ½Ç¶ÈÉ϶ÔËü×öÒ»¸ ......

LinuxÖеĵØÖ·¿Õ¼ä

LinuxÖеĵØÖ·¿Õ¼ä
ÓÐÕâôһϵÁеÄÎÊÌ⣬ÊÇ·ñÔÚÀ§ÈÅ×ÅÄ㣺Óû§³ÌÐò±àÒëÁ¬½ÓÐγɵĵØÖ·¿Õ¼äÔÚʲô·¶Î§ÄÚ£¿Äں˱àÒëºóµØÖ·¿Õ¼äÔÚʲô·¶Î§ÄÚ£¿Òª¶ÔÍâÉè½øÐзÃÎÊ£¬I/OµÄµØÖ·¿Õ¼äÓÖÊÇʲôÑùµÄ£¿
ÏȻشðµÚÒ»¸öÎÊÌâ¡£Linux×î³£¼ûµÄ¿ÉÖ´ÐÐÎļþ¸ñʽΪelf(Executable and Linkable Format)¡£ÔÚelf¸ñʽµÄ¿ÉÖ´ÐдúÂëÖУ¬ld×ÜÊÇ´Ó0x ......

LinuxÏÂscpµÄÓ÷¨


scp¾ÍÊÇsecure copy£¬Ò»¸öÔÚlinuxÏÂÓÃÀ´½øÐÐÔ¶³Ì¿½±´ÎļþµÄÃüÁî¡£
ÓÐʱÎÒÃÇÐèÒª»ñµÃÔ¶³Ì·þÎñÆ÷ÉϵÄij¸öÎļþ£¬¸Ã·þÎñÆ÷¼ÈûÓÐÅäÖÃftp·þÎñÆ÷£¬Ò²Ã»ÓÐ×ö¹²Ïí£¬ÎÞ·¨Í¨¹ý³£¹æ;¾¶»ñµÃÎļþʱ£¬Ö»ÐèҪͨ¹ý¼òµ¥µÄscpÃüÁî±ã¿É´ïµ½Ä¿µÄ¡£
Ò»¡¢½«±¾»úÎļþ¸´ÖƵ½Ô¶³Ì·þÎñÆ÷ÉÏ
#scp /home/administrator/news.txt root@192.168.6.12 ......

windowÓëlinuxÎļþ»¥´«Ö®ftp

¹ØÓÚwindowsÓëlinuxÖ®¼äÎļþ»¥´«
 
»·¾³£ºÓÐÁ½Ì¨Ö÷»ú
A£º192.168.2.109   OS£ºwindows xp
B£º192.168.2.113   OS£ºlinux £¨redhat5.3£©
 
Ä¿µÄ£ºÒªÊµÏÖÁ½Ì¨Ö÷»úÖ®¼äÎļþµÄ»¥´«¡£
 
±¾ÈËÔÚÍøÉÏ¿´¹ý¼¸ÖÖ·½·¨£¬ÓеÄÐèÒªµÚÈý·½Èí¼þ£¨±ÈÈ磺ÔÚWindows XPÏÂÓÃServ-uÈí¼þ¼ÜÉèÁËFTP·þÎñ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ