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

linux·Ç×èÈûsocket½Ì³Ì

        ±¾ÎIJ¢·Ç½âÊÍʲôÊÇ·Ç×èÈûsocket£¬Ò²²»ÊǽéÉÜsocket APIµÄÓ÷¨£¬ È¡¶ø´úÌæµÄÊÇÈÃÄã¸ÐÊÜʵ¼Ê¹¤×÷ÖеĴúÂë±àд¡£ËäÈ»ºÜ¼òª£¬µ«Äã¿ÉÒÔͨ¹ýmanÊÖ²áÓëÆäËü×ÊÔ´·Ç¸»ÄãµÄ´úÂë¡£Çë×¢Òâ±¾½Ì³ÌËù˵µÄÖ÷Ì⣬Èç¹ûϸ˵£¬ÄÚÈÝ¿ÉÒÔ´ïµ½Ò»±¾ÊéÄÚÈÝ£¬Äã»á·¢ÏÖ±¾½Ì³ÌºÜÓÐÓá£
±¾½Ì³ÌÄÚÈÝÈçÏ£º
        1. ¸Ä±äÒ»¸ö×èÈûµÄsocketΪ·Ç×èÈûģʽ¡£
        2. selectÄ£ÐÍ
        3. FDºê
        4. ¶Áдº¯Êý
        5. дһ¸ö·Ç×èÈûsocket´úÂëƬ
        6. Õû¸ö´úÂë
        7.ÏÂÒ»²½
 
        Èç¹ûÄãÔÚ´ËÓÐÐí¶àÎÊÌ⣬ÄÇô¹§Ï²Ä㣬ÔÚ³õ¼¶½×¶Î£¬ÈκÎÈ˶¼Ã»Óаþ¶áÄã·¢ÏÖÎÊÌâµÄȨÀû¡£¹ØÓÚÄãËù·¢ÏÖµÄÎÊÌ⣬Çë²»ÒªÓÌÔ¥emailÎÒ¡£
        Äã¿ÉÒÔ×ÔÓÉ·¢±í±¾½Ì³Ìµ½ÈκÎWWW»òFTPÍø²¿£¬µ«ÎÞÂÛÈçºÎÒ²Òª±£³ÖÔ­½Ì³ÌµÄÔ­ÐÍ¡£ÕâÑùÎÒ½«»á·Ç³£¸ÐлÄã¡£
1.¸Ä±äÒ»¸ö×èÈûµÄsocketΪ·Ç×èÈûģʽ
        ¼òµ¥µÄ¼¸ÐдúÂë¾Í¿ÉÒÔ´´½¨Ò»¸ösocket ²¢Á¬½Ó£¬¿´ÆðÀ´Èç´Ë¼òµ¥¡££¨Äã¿ÉÒÔ×Ô¼º¼ÓÈë´íÎó´¦Àí£©
s = socket(AF_INET, SOCK_STREAM, 0);
memset(&sin, 0, sizeof(struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = inet_addr(hstname);
if(sin.sin_addr.s_addr == INADDR_NONE) {
connect(s, (struct sockaddr *)&sin, sizeof(sin))

        ÓкܶàÖÖ·½·¨¿ÉÒÔÉèÖÃsocketΪ·Ç×èÈûģʽ£¬ ÎÒÔÚunixϳ£Óõķ½·¨ÈçÏ£º
int x;
x=fcntl(s,F_GETFL,0);
fcntl(s,F_SETFL,x | O_NONBLOCK);

        µ½ÏÖÔÚΪ´Ë£¬ Õâ¸ösocketÒÑΪ·Ç×èÈûģʽÁË£¬ÎÒÃÇ¿ÉÒ԰ѽ¹µã·ÅÔÚÈçºÎÓÃËüÁË¡£ µ«ÊÇÔÚ½Ó×Åд´úÂë֮ǰ£¬ÎÒÃÇÒª¿´¿´ÎÒÃǽ«ÒªÓõ½µÄÃüÁî¡£
2.Ñ¡ÔñÄ£ÐÍ
        selectÕâ¸ö·½·¨ÓÃÀ´¼ì²âÒ»¸ösocketÊÇ·ñÓÐÊý¾Ýµ½À´»òÊÇÊÇ·ñÓÐ×¼±¸ºÃµÄÊý¾ÝÒª·¢ËÍ¡£Éù


Ïà¹ØÎĵµ£º

Linux ²Ù×÷ϵͳ:deb°²×°°üµÄ°²×°·½·¨

deb ÊÇdebian linus µÄ°²×°¸ñʽ£¬¸úred hat µÄrpmÏàËÆ
°²×°£º dpkg -i file.deb
²»¹ýÒª°²×°dpkgµÄpackage,Ò²¿ÉÓÃalienÕâÀàÈí¼þ½«packageתΪrpmµÈ¸ñʽ£¬»òÖ±½Óϸörpm »òtar°ü¡£
¹ØÓÚdeb°üת»»³ÉrpmµÄ·½·¨£º
sudo apt-get install alien #alienĬÈÏûÓа²×°£¬ËùÒÔÊ×ÏÈÒª°²×°Ëü¡£
sudo alien xxxx.rpm #½«rpmת»»Î»deb ......

LinuxϵͳÐÂÊÖѧϰµÄ11µã½¨Òé

Ëæ×ÅLinuxÓ¦ÓõÄÀ©Õ¹Ðí¶àÅóÓÑ¿ªÊ¼½Ó´¥Linux£¬¸ù¾ÝѧϰWindwosµÄ¾­ÑéÍùÍùÓÐһЩãȻµÄ¸Ð¾õ£º²»Öª´ÓºÎ´¦¿ªÊ¼Ñ§Æð¡£ÕâÀï½éÉÜѧϰLinuxµÄһЩ½¨Òé¡£
Ò»¡¢´Ó»ù´¡¿ªÊ¼£º³£³£ÓÐЩÅóÓÑÔÚLinuxÂÛ̳ÎÊһЩÎÊÌ⣬²»¹ý£¬ÆäÖдó¶àÊýµÄÎÊÌⶼÊǺܻù´¡µÄ¡£ÀýÈ磺ΪʲôÎÒʹÓÃÒ»¸öÃüÁîµÄʱºò£¬ÏµÍ³¸æËßÎÒÕÒ²»µ½¸ÃĿ¼£¬ÎÒÒªÈçºÎÏÞÖÆʹÓÃÕß ......

LinuxÏÂCÓïÑÔ±à³Ì ÐźŴ¦Àíº¯Êý

Ç°ÑÔ:ÕâÒ»ÕÂÎÒÃÇÌÖÂÛÒ»ÏÂLinuxϵÄÐźŴ¦Àíº¯Êý. 
     LinuxϵÄÐźŴ¦Àíº¯Êý: 
1.ÐźŵIJúÉú 
2.ÐźŵĴ¦Àí 
3.ÆäËüÐźź¯Êý 
--------------------------------------------------------------------------------
Ò»¸öʵÀý 
1¡£ÐźŵIJúÉú  ......

Linux¸÷·¢Ðа汾 ÓÅȱµã ¼ò½é


 
Linux¸÷·¢Ðа汾 ÓÅȱµã ¼ò½é
À´Ô´: ChinaUnix²©¿Í ¡¡ÈÕÆÚ£º 2008.01.21 13:43¡¡(¹²ÓÐ25ÌõÆÀÂÛ) ÎÒÒªÆÀÂÛ
 
Linux×îÔçÓÉLinus Benedict TorvaldsÔÚ1991Ä꿪ʼ±àд¡£ÔÚÕâ֮ǰ£¬Richard
Stallman´´½¨ÁËFree Software
Foundation£¨FSF£©×éÖ¯ÒÔ¼°GNUÏîÄ¿£¬²¢²»¶ÏµÄ±àд´´½¨GNU³ÌÐò£¨´ËÀà³ÌÐòµÄÐí¿É·½Ê½¾ùΪ ......

ǶÈëʽLinux²Ù×÷ϵͳѧϰ¹æ

ǶÈëʽLinux²Ù×÷ϵͳѧϰ¹æ»®
ARM+LINUX·Ïߣ¬Ö÷¹¥Ç¶ÈëʽLinux²Ù×÷ϵͳ¼°ÆäÉÏÓ¦ÓÃÈí¼þ¿ª·¢Ä¿±ê£º 
£¨1£© ÕÆÎÕÖ÷Á÷ǶÈëʽ΢´¦ÀíÆ÷µÄ½á¹¹ÓëÔ­Àí£¨³õ²½¶¨Îªarm9£© 
£¨2£© ±ØÐëÕÆÎÕÒ»¸öǶÈëʽ²Ù×÷ϵͳ £¨³õ²½¶¨Îªuclinux»òlinux,°æ±¾´ý¶¨£© 
£¨3£© ±ØÐëÊìϤǶÈëʽÈí¼þ¿ª·¢Á÷³Ì²¢ÖÁÉÙ×öÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ