锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲中文久久精品无码ww16,99精品伊人久久久大香线蕉,久久本道久久综合伊人http://www.shnenglu.com/true/archive/2011/01/13/138422.htmltruetrueWed, 12 Jan 2011 16:51:00 GMThttp://www.shnenglu.com/true/archive/2011/01/13/138422.htmlhttp://www.shnenglu.com/true/comments/138422.htmlhttp://www.shnenglu.com/true/archive/2011/01/13/138422.html#Feedback16http://www.shnenglu.com/true/comments/commentRss/138422.htmlhttp://www.shnenglu.com/true/services/trackbacks/138422.html闃呰鍏ㄦ枃

true 2011-01-13 00:51 鍙戣〃璇勮
]]>
winpcap鎶撳彇鏃犵嚎緗戝崱涓婄殑鏁版嵁鍖?/title><link>http://www.shnenglu.com/true/archive/2010/12/22/137232.html</link><dc:creator>true</dc:creator><author>true</author><pubDate>Wed, 22 Dec 2010 13:59:00 GMT</pubDate><guid>http://www.shnenglu.com/true/archive/2010/12/22/137232.html</guid><wfw:comment>http://www.shnenglu.com/true/comments/137232.html</wfw:comment><comments>http://www.shnenglu.com/true/archive/2010/12/22/137232.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/true/comments/commentRss/137232.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/true/services/trackbacks/137232.html</trackback:ping><description><![CDATA[      wireshark錛?a >http://www.wireshark.org/</a>錛夋槸鎴戠粡甯哥敤鍒扮殑鎶撳寘宸ュ叿錛岃繖瀵逛簬緗戠粶紼嬪簭鐨勮皟璇曡嚦鍏抽噸瑕侊紝鐗瑰埆鏄鎴風浜哄憳鍜屾湇鍔$浜哄憳閮借涓鴻嚜宸辯殑浠g爜娌¢棶棰樻椂錛寃ireshark鏈韓鏄紑婧愮殑錛屽湪windows騫沖彴涓嬪熀浜?nbsp;winpcap錛?a >http://www.winpcap.org/</a>錛夊紑鍙戠殑錛屽畨瑁厀ireshark鐨勬椂鍊欙紝浼氭彁紺哄湪綰垮畨瑁厀inpcap錛屼粖澶╁湪絎旇鏈笂鐢╒S2008,緙栬瘧浜咵xamples-pcap涓嬮潰鐨刡asic_dump鍜宐asic_dump_ex錛屼笉鏇炬兂鍒扮殑鏄姄涓嶅埌鍖咃紝鐢氭槸濂囨紝鍥犱負鐢╳ireshark鎶撳寘鏄彲浠ョ殑錛屽洜姝ゆ鐤戞槸涓嶆槸鍝釜鍙傛暟璁炬柦涓嶅錛岀粓浜庢瘮瀵箇ireshark錛屽緱鍑虹粨璁猴細灝唒cap_open_live鐨勭鍥涗釜鍙傛暟璁句負0錛屽嵆涓嶈兘鎵撳紑娣鋒潅妯″紡錛?br><br>if ((adhandle= pcap_open_live(d->name, // name of the device<br>        65536,   // portion of the packet to capture. <br>           // 65536 grants that the whole packet will be captured on all the MACs.<br>       <span style="COLOR: #0000ff"> 0</span>,    // promiscuous mode (nonzero means promiscuous)<br>        1000,   // read timeout<br>        errbuf   // error buffer<br>        )) == NULL)<br> {<br>  fprintf(stderr,"\nUnable to open the adapter. %s is not supported by WinPcap\n", d->name);<br>  /* Free the device list */<br>  pcap_freealldevs(alldevs);<br>  return -1;<br> } <img src ="http://www.shnenglu.com/true/aggbug/137232.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/true/" target="_blank">true</a> 2010-12-22 21:59 <a href="http://www.shnenglu.com/true/archive/2010/12/22/137232.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浣撻獙RakNet鐨凴PC3http://www.shnenglu.com/true/archive/2009/10/05/97901.htmltruetrueMon, 05 Oct 2009 12:50:00 GMThttp://www.shnenglu.com/true/archive/2009/10/05/97901.htmlhttp://www.shnenglu.com/true/comments/97901.htmlhttp://www.shnenglu.com/true/archive/2009/10/05/97901.html#Feedback3http://www.shnenglu.com/true/comments/commentRss/97901.htmlhttp://www.shnenglu.com/true/services/trackbacks/97901.html闃呰鍏ㄦ枃

true 2009-10-05 20:50 鍙戣〃璇勮
]]>
鍗忚璁捐涔嬩簩 緇撴瀯浣撶被鍨嬬殑緙栫爜http://www.shnenglu.com/true/archive/2009/09/11/95949.htmltruetrueFri, 11 Sep 2009 11:35:00 GMThttp://www.shnenglu.com/true/archive/2009/09/11/95949.htmlhttp://www.shnenglu.com/true/comments/95949.htmlhttp://www.shnenglu.com/true/archive/2009/09/11/95949.html#Feedback0http://www.shnenglu.com/true/comments/commentRss/95949.htmlhttp://www.shnenglu.com/true/services/trackbacks/95949.html闃呰鍏ㄦ枃

true 2009-09-11 19:35 鍙戣〃璇勮
]]>
鎬紓鐨刡oost錛宖atal error LNK1104: 鏃犳硶鎵撳紑鏂囦歡鈥渓ibboost_system-vc80-mt-gd-1_35.lib鈥?/title><link>http://www.shnenglu.com/true/archive/2008/07/16/56283.html</link><dc:creator>true</dc:creator><author>true</author><pubDate>Wed, 16 Jul 2008 05:19:00 GMT</pubDate><guid>http://www.shnenglu.com/true/archive/2008/07/16/56283.html</guid><wfw:comment>http://www.shnenglu.com/true/comments/56283.html</wfw:comment><comments>http://www.shnenglu.com/true/archive/2008/07/16/56283.html#Feedback</comments><slash:comments>13</slash:comments><wfw:commentRss>http://www.shnenglu.com/true/comments/commentRss/56283.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/true/services/trackbacks/56283.html</trackback:ping><description><![CDATA[<p>#include <iostream><br>#include <boost/asio.hpp><br>#include <boost/date_time/posix_time/posix_time.hpp></p> <p>int main()<br>{<br> boost::asio::io_service io;</p> <p> boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));<br> t.wait();</p> <p> std::cout << "Hello, world!\n";</p> <p> return 0;<br>}<br></p> 涓婇潰鏄痓oost鏂囨。鑷甫鐨勪唬鐮侊紝緙栬瘧鍑虹幇閿欒銆備唬鐮佹槸涓嶉渶瑕侀摼鎺ibboost_system-vc80-mt-gd-1_35.lib錛屼負浠涔堣繕鍑虹幇榪欐牱鐨勯敊璇憿錛熶粬榛樿榪炴帴錛熺煡閬撶殑錛屾仮澶嶄竴涓嬶細錛? <img src ="http://www.shnenglu.com/true/aggbug/56283.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/true/" target="_blank">true</a> 2008-07-16 13:19 <a href="http://www.shnenglu.com/true/archive/2008/07/16/56283.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>epoll()瀹炵幇鍒嗘瀽銆怹T銆?/title><link>http://www.shnenglu.com/true/archive/2008/06/01/51848.html</link><dc:creator>true</dc:creator><author>true</author><pubDate>Sun, 01 Jun 2008 14:55:00 GMT</pubDate><guid>http://www.shnenglu.com/true/archive/2008/06/01/51848.html</guid><wfw:comment>http://www.shnenglu.com/true/comments/51848.html</wfw:comment><comments>http://www.shnenglu.com/true/archive/2008/06/01/51848.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/true/comments/commentRss/51848.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/true/services/trackbacks/51848.html</trackback:ping><description><![CDATA[<div id="pjrllzj" class=tit>epoll()瀹炵幇鍒嗘瀽<br><br><a >http://hi.baidu.com/rwen2012/blog/item/0f2f8c13eb7f3621dd5401a8.html</a></div> <div id="xjbzbnh" class=date>2007-07-04 17:50</div> <table style="TABLE-LAYOUT: fixed"> <tbody> <tr> <td> <div id="rvtdrbj" class=cnt id=blog_text>                                            <br>/*<br>* This structure is stored inside the "private_data" member of the file<br>* structure and rapresent the main data sructure for the eventpoll<br>* interface.<br>*/<br>struct eventpoll {<br>   /* Protect the this structure access */<br>   rwlock_t lock;<br></div> </td> </tr> </tbody> </table> <img src ="http://www.shnenglu.com/true/aggbug/51848.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/true/" target="_blank">true</a> 2008-06-01 22:55 <a href="http://www.shnenglu.com/true/archive/2008/06/01/51848.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍦↙inux涓婂紑鍙戠綉緇滄湇鍔″櫒鐨勪竴浜涚浉鍏崇粏鑺?poll涓巈poll[杞琞http://www.shnenglu.com/true/archive/2008/06/01/51843.htmltruetrueSun, 01 Jun 2008 14:15:00 GMThttp://www.shnenglu.com/true/archive/2008/06/01/51843.htmlhttp://www.shnenglu.com/true/comments/51843.htmlhttp://www.shnenglu.com/true/archive/2008/06/01/51843.html#Feedback0http://www.shnenglu.com/true/comments/commentRss/51843.htmlhttp://www.shnenglu.com/true/services/trackbacks/51843.htmlhttp://hi.baidu.com/xproduct/blog/calendar/200706
2007-06-30 23:58
闅忕潃2.6鍐呮牳瀵筫poll鐨勫畬鍏ㄦ敮鎸侊紝緗戠粶涓婂緢澶氱殑鏂囩珷鍜岀ず渚嬩唬鐮侀兘鎻愪緵浜嗚繖鏍蜂竴涓俊鎭細浣跨敤epoll浠f浛浼犵粺鐨刾oll鑳界粰緗戠粶鏈嶅姟搴旂敤甯︽潵鎬ц兘涓?鐨勬彁鍗囥備絾澶у鏂囩珷閲屽叧浜庢ц兘鎻愬崌鐨勫師鍥犺В閲婄殑杈冨皯錛岃繖閲屾垜灝嗚瘯鍒嗘瀽涓涓嬪唴鏍革紙2.6.21.1錛変唬鐮佷腑poll涓巈poll鐨勫伐浣滃師鐞嗭紝鐒跺悗鍐嶉氳繃涓浜?嫻嬭瘯鏁版嵁鏉ュ姣斿叿浣撴晥鏋溿?br>
   POLL錛?br>
   鍏堣poll錛宲oll鎴杝elect涓哄ぇ閮ㄥ垎Unix/Linux紼嬪簭鍛樻墍鐔熸倝錛岃繖淇╀釜涓滆タ鍘熺悊綾諱技錛屾ц兘涓婁篃涓嶅瓨鍦ㄦ槑鏄懼樊寮傦紝浣唖elect瀵規墍鐩戞帶鐨勬枃浠舵弿榪扮鏁伴噺鏈夐檺鍒訛紝鎵浠ヨ繖閲岄夌敤poll鍋氳鏄庛?br>
   poll鏄竴涓郴緇熻皟鐢紝鍏跺唴鏍稿叆鍙e嚱鏁頒負sys_poll錛宻ys_poll鍑犱箮涓嶅仛浠諱綍澶勭悊鐩存帴璋冪敤do_sys_poll錛宒o_sys_poll鐨勬墽琛岃繃紼嬪彲浠ュ垎涓轟笁涓儴鍒嗭細

   1錛屽皢鐢ㄦ埛浼犲叆鐨刾ollfd鏁扮粍鎷瘋礉鍒板唴鏍哥┖闂達紝鍥犱負鎷瘋礉鎿嶄綔鍜屾暟緇勯暱搴︾浉鍏籌紝鏃墮棿涓婅繖鏄竴涓狾錛坣錛夋搷浣滐紝榪欎竴姝ョ殑浠g爜鍦╠o_sys_poll涓寘鎷粠鍑芥暟寮濮嬪埌璋冪敤do_poll鍓嶇殑閮ㄥ垎銆?br>
   2錛屾煡璇㈡瘡涓枃浠舵弿榪扮瀵瑰簲璁懼鐨勭姸鎬侊紝濡傛灉璇ヨ澶囧皻鏈氨緇紝鍒欏湪璇ヨ澶囩殑絳夊緟闃熷垪涓姞鍏ヤ竴欏瑰茍緇х畫鏌ヨ涓嬩竴璁懼鐨勭姸鎬併傛煡璇㈠畬鎵鏈夎澶囧悗濡傛灉娌℃湁涓涓 澶囧氨緇紝榪欐椂鍒欓渶瑕佹寕璧峰綋鍓嶈繘紼嬬瓑寰咃紝鐩村埌璁懼灝辯華鎴栬呰秴鏃訛紝鎸傝搗鎿嶄綔鏄氳繃璋冪敤schedule_timeout鎵ц鐨勩傝澶囧氨緇悗榪涚▼琚氱煡緇х畫榪?琛岋紝榪欐椂鍐嶆閬嶅巻鎵鏈夎澶囷紝浠ユ煡鎵懼氨緇澶囥傝繖涓姝ュ洜涓轟袱嬈¢亶鍘嗘墍鏈夎澶囷紝鏃墮棿澶嶆潅搴︿篃鏄疧錛坣錛夛紝榪欓噷闈笉鍖呮嫭絳夊緟鏃墮棿銆傜浉鍏充唬鐮佸湪do_poll鍑芥暟 涓?br>
   3錛屽皢鑾峰緱鐨勬暟鎹紶閫佸埌鐢ㄦ埛絀洪棿騫舵墽琛岄噴鏀懼唴瀛樺拰鍓ョ絳夊緟闃熷垪絳夊杽鍚庡伐浣滐紝鍚戠敤鎴風┖闂存嫹璐濇暟鎹笌鍓ョ絳夊緟闃熷垪絳夋搷浣滅殑鐨勬椂闂村鏉傚害鍚屾牱鏄疧錛坣錛夛紝鍏蜂綋浠g爜鍖呮嫭do_sys_poll鍑芥暟涓皟鐢╠o_poll鍚庡埌緇撴潫鐨勯儴鍒嗐?br>
   EPOLL錛?br>
   鎺ヤ笅鏉ュ垎鏋恊poll錛屼笌poll/select涓嶅悓錛宔poll涓嶅啀鏄竴涓崟鐙殑緋葷粺璋冪敤錛岃屾槸鐢眅poll_create/epoll_ctl/epoll_wait涓変釜緋葷粺璋冪敤緇勬垚錛屽悗闈㈠皢浼氱湅鍒拌繖鏍峰仛鐨勫ソ澶勩?br>
   鍏堟潵鐪媠ys_epoll_create(epoll_create瀵瑰簲鐨勫唴鏍稿嚱鏁幫級錛岃繖涓嚱鏁頒富瑕佹槸鍋氫竴浜涘噯澶囧伐浣滐紝姣斿鍒涘緩鏁版嵁緇撴瀯錛屽垵濮嬪寲鏁版嵁騫舵渶緇堣繑鍥炰竴涓枃浠舵弿榪扮錛堣〃紺烘柊鍒涘緩鐨勮櫄鎷焑poll鏂囦歡錛夛紝榪欎釜鎿嶄綔鍙互璁や負鏄竴涓浐瀹氭椂闂寸殑鎿嶄綔銆?br>
       epoll鏄仛涓轟竴涓櫄鎷熸枃浠剁郴緇熸潵瀹炵幇鐨勶紝榪欐牱鍋氳嚦灝戞湁浠ヤ笅涓や釜濂藉錛?br>
       1錛屽彲浠ュ湪鍐呮牳閲岀淮鎶や竴浜涗俊鎭紝榪欎簺淇℃伅鍦ㄥ嬈poll_wait闂存槸淇濇寔鐨勶紝姣斿鎵鏈夊彈鐩戞帶鐨勬枃浠舵弿榪扮銆?br>
       2錛?epoll鏈韓涔熷彲浠ヨpoll/epoll;

   鍏蜂綋epoll鐨勮櫄鎷熸枃浠剁郴緇熺殑瀹炵幇鍜屾ц兘鍒嗘瀽鏃犲叧錛屼笉鍐嶈禈榪般?br>
   鍦╯ys_epoll_create涓繕鑳界湅鍒頒竴涓粏鑺傦紝灝辨槸epoll_create鐨勫弬鏁皊ize鍦ㄧ幇闃舵鏄病鏈夋剰涔夌殑錛屽彧瑕佸ぇ浜庨浂灝辮銆?br>
   鎺ョ潃鏄痵ys_epoll_ctl(epoll_ctl瀵瑰簲鐨勫唴鏍稿嚱鏁幫級錛岄渶瑕佹槑紜殑鏄瘡嬈¤皟鐢╯ys_epoll_ctl鍙鐞嗕竴涓枃浠舵弿榪扮錛岃繖閲屼富 瑕佹弿榪板綋op涓篍POLL_CTL_ADD鏃剁殑鎵ц榪囩▼錛宻ys_epoll_ctl鍋氫竴浜涘畨鍏ㄦф鏌ュ悗榪涘叆ep_insert錛宔p_insert閲屽皢 ep_poll_callback鍋氫負鍥炴帀鍑芥暟鍔犲叆璁懼鐨勭瓑寰呴槦鍒楋紙鍋囧畾榪欐椂璁懼灝氭湭灝辯華錛夛紝鐢變簬姣忔poll_ctl鍙搷浣滀竴涓枃浠舵弿榪扮錛屽洜姝や篃鍙互 璁や負榪欐槸涓涓狾(1)鎿嶄綔

       ep_poll_callback鍑芥暟寰堝叧閿紝瀹冨湪鎵絳夊緟鐨勮澶囧氨緇悗琚郴緇熷洖鎺夛紝鎵ц涓や釜鎿嶄綔錛?br>
   1錛屽皢灝辯華璁懼鍔犲叆灝辯華闃熷垪錛岃繖涓姝ラ伩鍏嶄簡鍍弍oll閭f牱鍦ㄨ澶囧氨緇悗鍐嶆杞鎵鏈夎澶囨壘灝辯華鑰咃紝闄嶄綆浜嗘椂闂村鏉傚害錛岀敱O錛坣錛夊埌O錛?錛?

   2錛屽敜閱掕櫄鎷熺殑epoll鏂囦歡;

   鏈鍚庢槸sys_epoll_wait錛岃繖閲屽疄闄呮墽琛屾搷浣滅殑鏄痚p_poll鍑芥暟銆傝鍑芥暟絳夊緟灝嗚繘紼嬭嚜韜彃鍏ヨ櫄鎷焑poll鏂囦歡鐨勭瓑寰呴槦鍒楋紝鐩村埌琚敜閱掞紙瑙?涓婇潰ep_poll_callback鍑芥暟鎻忚堪錛夛紝鏈鍚庢墽琛宔p_events_transfer灝嗙粨鏋滄嫹璐濆埌鐢ㄦ埛絀洪棿銆傜敱浜庡彧鎷瘋礉灝辯華璁懼淇℃伅錛屾墍浠ヨ繖 閲岀殑鎷瘋礉鏄竴涓狾(1錛夋搷浣溿?br>
   榪樻湁涓涓浜哄叧蹇冪殑闂灝辨槸epoll瀵笶POLLET鐨勫鐞嗭紝鍗寵竟娌胯Е鍙戠殑澶勭悊錛岀矖鐣ョ湅浠g爜灝辨槸鎶婁竴閮ㄥ垎姘村鉤瑙﹀彂妯″紡涓嬪唴鏍稿仛鐨勫伐浣滀氦緇欑敤鎴鋒潵澶勭悊錛岀洿瑙変笂涓嶄細瀵規ц兘鏈夊お澶у獎鍝嶏紝鎰熷叴瓚g殑鏈嬪弸嬈㈣繋璁ㄨ銆?br>
   POLL/EPOLL瀵規瘮錛?br>
   琛ㄩ潰涓妏oll鐨勮繃紼嬪彲浠ョ湅浣滄槸鐢變竴嬈poll_create/鑻ュ共嬈poll_ctl/涓嬈poll_wait/涓嬈lose絳夌郴緇熻皟鐢ㄦ瀯鎴愶紝 瀹為檯涓奺poll灝唒oll鍒嗘垚鑻ュ共閮ㄥ垎瀹炵幇鐨勫師鍥犳鏄洜涓烘湇鍔″櫒杞歡涓嬌鐢╬oll鐨勭壒鐐癸紙姣斿Web鏈嶅姟鍣級錛?br>
   1錛岄渶瑕佸悓鏃秔oll澶ч噺鏂囦歡鎻忚堪絎?

   2錛屾瘡嬈oll瀹屾垚鍚庡氨緇殑鏂囦歡鎻忚堪絎﹀彧鍗犳墍鏈夎poll鐨勬弿榪扮鐨勫緢灝戜竴閮ㄥ垎銆?br>
   3錛屽墠鍚庡嬈oll璋冪敤瀵規枃浠舵弿榪扮鏁扮粍錛坲fds錛夌殑淇敼鍙槸寰堝皬;

   浼犵粺鐨刾oll鍑芥暟鐩稿綋浜庢瘡嬈¤皟鐢ㄩ兘閲嶈搗鐐夌伓錛屼粠鐢ㄦ埛絀洪棿瀹屾暣璇誨叆ufds錛屽畬鎴愬悗鍐嶆瀹屽叏鎷瘋礉鍒扮敤鎴風┖闂達紝鍙﹀姣忔poll閮介渶瑕佸鎵鏈夎澶囧仛鑷沖皯鍋氫竴嬈″姞鍏ュ拰鍒犻櫎絳夊緟闃熷垪鎿嶄綔錛岃繖浜涢兘鏄綆鏁堢殑鍘熷洜銆?br>
       epoll灝嗕互涓婃儏鍐甸兘緇嗗寲鑰冭檻錛屼笉闇瑕佹瘡嬈¢兘瀹屾暣璇誨叆杈撳嚭ufds錛屽彧闇浣跨敤epoll_ctl璋冩暣鍏朵腑涓灝忛儴鍒嗭紝涓嶉渶瑕佹瘡嬈?epoll_wait閮芥墽琛屼竴嬈″姞鍏ュ垹闄ょ瓑寰呴槦鍒楁搷浣滐紝鍙﹀鏀硅繘鍚庣殑鏈哄埗浣跨殑涓嶅繀鍦ㄦ煇涓澶囧氨緇悗鎼滅儲鏁翠釜璁懼鏁扮粍榪涜鏌ユ壘錛岃繖浜涢兘鑳芥彁楂樻晥鐜囥傚彟澶栨渶鏄?鏄劇殑涓鐐癸紝浠庣敤鎴風殑浣跨敤鏉ヨ錛屼嬌鐢╡poll涓嶅繀姣忔閮借疆璇㈡墍鏈夎繑鍥炵粨鏋滃凡鎵懼嚭鍏朵腑鐨勫氨緇儴鍒嗭紝O錛坣錛夊彉O錛?錛夛紝瀵規ц兘涔熸彁楂樹笉灝戙?br>
   姝ゅ榪欓噷榪樺彂鐜頒竴鐐癸紝鏄笉鏄皢epoll_ctl鏀規垚涓嬈″彲浠ュ鐞嗗涓猣d錛堝儚semctl閭f牱錛変細鎻愰珮浜涜鎬ц兘鍛紵鐗瑰埆鏄湪鍋囪緋葷粺璋冪敤姣旇緝鑰楁椂鐨勫熀紜涓娿備笉榪囧叧浜庣郴緇熻皟鐢ㄧ殑鑰楁椂闂榪樹細鍦ㄤ互鍚庡垎鏋愩?br>
   POLL/EPOLL嫻嬭瘯鏁版嵁瀵規瘮錛?br>
   嫻嬭瘯鐨勭幆澧冿細鎴戝啓浜嗕笁孌典唬鐮佹潵鍒嗗埆妯℃嫙鏈嶅姟鍣紝媧誨姩鐨勫鎴風錛屽兊姝葷殑瀹㈡埛绔紝鏈嶅姟鍣ㄨ繍琛屼簬涓涓嚜緙栬瘧鐨勬爣鍑?.6.11鍐呮牳緋葷粺涓婏紝紜歡涓?PIII933錛屼袱涓鎴風鍚勮嚜榪愯鍦ㄥ彟澶栫殑PC涓婏紝榪欎袱鍙癙C姣旀湇鍔″櫒鐨勭‖浠舵ц兘瑕佸ソ錛屼富瑕佹槸淇濊瘉鑳借交鏄撹鏈嶅姟鍣ㄦ弧杞斤紝涓夊彴鏈哄櫒闂翠嬌鐢ㄤ竴涓?00M浜ゆ崲 鏈鴻繛鎺ャ?br>
   鏈嶅姟鍣ㄦ帴鍙楀茍poll鎵鏈夎繛鎺ワ紝濡傛灉鏈塺equest鍒拌揪鍒欏洖澶嶄竴涓猺esponse錛岀劧鍚庣戶緇璸oll銆?br>
   媧誨姩鐨勫鎴風錛圓ctive Client錛夋ā鎷熻嫢騫插茍鍙戠殑媧誨姩榪炴帴錛岃繖浜涜繛鎺ヤ笉闂存柇鐨勫彂閫佽姹傛帴鍙楀洖澶嶃?br>
   鍍墊鐨勫鎴風錛坺ombie錛夋ā鎷熶竴浜涘彧榪炴帴浣嗕笉鍙戦佽姹傜殑瀹㈡埛绔紝鍏剁洰鐨勫彧鏄崰鐢ㄦ湇鍔″櫒鐨刾oll鎻忚堪絎﹁祫婧愩?br>
       嫻嬭瘯榪囩▼錛氫繚鎸?0涓茍鍙戞椿鍔ㄨ繛鎺ワ紝涓嶆柇鐨勮皟鏁村兊騫跺彂榪炴帴鏁幫紝璁板綍鍦ㄤ笉鍚屾瘮渚嬩笅浣跨敤poll涓巈poll鐨勬ц兘宸埆銆傚兊姝誨茍鍙戣繛鎺ユ暟鏍規嵁姣斾緥鍒嗗埆鏄細0錛?0錛?0錛?0錛?0錛?60錛?20錛?40錛?280錛?560錛?120錛?0240銆?br>
   涓嬪浘涓í杞磋〃紺哄兊姝誨茍鍙戣繛鎺ヤ笌媧誨姩騫跺彂榪炴帴涔嬫瘮錛岀旱杞磋〃紺哄畬鎴?0000嬈¤姹傚洖澶嶆墍鑺辮垂鐨勬椂闂達紝浠ョ涓哄崟浣嶃傜孩鑹茬嚎鏉¤〃紺簆oll鏁版嵁錛岀豢鑹茶〃紺?epoll鏁版嵁銆傚彲浠ョ湅鍑猴紝poll鍦ㄦ墍鐩戞帶鐨勬枃浠舵弿榪扮鏁伴噺澧炲姞鏃訛紝鍏惰楁椂鍛堢嚎鎬у闀匡紝鑰宔poll鍒欑淮鎸佷簡涓涓鉤紼崇殑鐘舵侊紝鍑犱箮涓嶅彈鎻忚堪絎︿釜鏁板獎鍝嶃?br>
   鍦ㄧ洃鎺х殑鎵鏈夊鎴風閮芥槸媧誨姩鏃訛紝poll鐨勬晥鐜囦細鐣ラ珮浜巈poll錛堜富瑕佸湪鍘熺偣闄勮繎錛屽嵆鍍墊騫跺彂榪炴帴涓?鏃訛紝鍥句笂涓嶆槗鐪嬪嚭鏉ワ級錛岀┒绔焑poll瀹炵幇姣攑oll澶嶆潅錛岀洃鎺у皯閲忔弿榪扮騫墮潪瀹冪殑闀?/div>


true 2008-06-01 22:15 鍙戣〃璇勮
]]>
man epollhttp://www.shnenglu.com/true/archive/2008/05/21/50647.htmltruetrueWed, 21 May 2008 06:43:00 GMThttp://www.shnenglu.com/true/archive/2008/05/21/50647.htmlhttp://www.shnenglu.com/true/comments/50647.htmlhttp://www.shnenglu.com/true/archive/2008/05/21/50647.html#Feedback0http://www.shnenglu.com/true/comments/commentRss/50647.htmlhttp://www.shnenglu.com/true/services/trackbacks/50647.htmlEPOLL(4) Linux Programmer's Manual EPOLL(4) NAME epoll - I/O event notification facility SYNOPSIS #include <sys/epoll.h> DESCRIPTION epoll is a variant of poll(2) that can be used either as Edge or Level Triggered interface and scales well to large numbers of watched fds. Three system calls are provided to set up and control an epoll set: epoll_create(2), epoll_ctl(2), epoll_wait(2). An epoll set is connected to a file descriptor created by epoll_cre- ate(2). Interest for certain file descriptors is then registered via epoll_ctl(2). Finally, the actual wait is started by epoll_wait(2). NOTES The epoll event distribution interface is able to behave both as Edge Triggered ( ET ) and Level Triggered ( LT ). The difference between ET and LT event distribution mechanism can be described as follows. Sup- pose that this scenario happens : 1 The file descriptor that represent the read side of a pipe ( RFD ) is added inside the epoll device. 2 Pipe writer writes 2Kb of data on the write side of the pipe. 3 A call to epoll_wait(2) is done that will return RFD as ready file descriptor. 4 The pipe reader reads 1Kb of data from RFD. 5 A call to epoll_wait(2) is done. If the RFD file descriptor has been added to the epoll interface using the EPOLLET flag, the call to epoll_wait(2) done in step 5 will proba- bly hang because of the available data still present in the file input buffers and the remote peer might be expecting a response based on the data it already sent. The reason for this is that Edge Triggered event distribution delivers events only when events happens on the monitored file. So, in step 5 the caller might end up waiting for some data that is already present inside the input buffer. In the above example, an event on RFD will be generated because of the write done in 2 , and the event is consumed in 3. Since the read operation done in 4 does not consume the whole buffer data, the call to epoll_wait(2) done in step 5 might lock indefinitely. The epoll interface, when used with the EPOL- LET flag ( Edge Triggered ) should use non-blocking file descriptors to avoid having a blocking read or write starve the task that is handling multiple file descriptors. The suggested way to use epoll as an Edge Triggered ( EPOLLET ) interface is below, and possible pitfalls to avoid follow. i with non-blocking file descriptors ii by going to wait for an event only after read(2) or write(2) return EAGAIN On the contrary, when used as a Level Triggered interface, epoll is by all means a faster poll(2), and can be used wherever the latter is used since it shares the same semantics. Since even with the Edge Triggered epoll multiple events can be generated up on receival of multiple chunks of data, the caller has the option to specify the EPOLLONESHOT flag, to tell epoll to disable the associated file descriptor after the receival of an event with epoll_wait(2). When the EPOLLONESHOT flag is specified, it is caller responsibility to rearm the file descriptor using epoll_ctl(2) with EPOLL_CTL_MOD. EXAMPLE FOR SUGGESTED USAGE While the usage of epoll when employed like a Level Triggered interface does have the same semantics of poll(2), an Edge Triggered usage requires more clarifiction to avoid stalls in the application event loop. In this example, listener is a non-blocking socket on which lis- ten(2) has been called. The function do_use_fd() uses the new ready file descriptor until EAGAIN is returned by either read(2) or write(2). An event driven state machine application should, after having received EAGAIN, record its current state so that at the next call to do_use_fd() it will continue to read(2) or write(2) from where it stopped before. struct epoll_event ev, *events; for(;;) { nfds = epoll_wait(kdpfd, events, maxevents, -1); for(n = 0; n < nfds; ++n) { if(events[n].data.fd == listener) { client = accept(listener, (struct sockaddr *) &local, &addrlen); if(client < 0){ perror("accept"); continue; } setnonblocking(client); ev.events = EPOLLIN | EPOLLET; ev.data.fd = client; if (epoll_ctl(kdpfd, EPOLL_CTL_ADD, client, &ev) < 0) { fprintf(stderr, "epoll set insertion error: fd=%d0, client); return -1; } } else do_use_fd(events[n].data.fd); } } When used as an Edge triggered interface, for performance reasons, it is possible to add the file descriptor inside the epoll interface ( EPOLL_CTL_ADD ) once by specifying ( EPOLLIN|EPOLLOUT ). This allows you to avoid continuously switching between EPOLLIN and EPOLLOUT call- ing epoll_ctl(2) with EPOLL_CTL_MOD. QUESTIONS AND ANSWERS (from linux-kernel) Q1 What happens if you add the same fd to an epoll_set twice? A1 You will probably get EEXIST. However, it is possible that two threads may add the same fd twice. This is a harmless condition. Q2 Can two epoll sets wait for the same fd? If so, are events reported to both epoll sets fds? A2 Yes. However, it is not recommended. Yes it would be reported to both. Q3 Is the epoll fd itself poll/epoll/selectable? A3 Yes. Q4 What happens if the epoll fd is put into its own fd set? A4 It will fail. However, you can add an epoll fd inside another epoll fd set. Q5 Can I send the epoll fd over a unix-socket to another process? A5 No. Q6 Will the close of an fd cause it to be removed from all epoll sets automatically? A6 Yes. Q7 If more than one event comes in between epoll_wait(2) calls, are they combined or reported separately? A7 They will be combined. Q8 Does an operation on an fd affect the already collected but not yet reported events? A8 You can do two operations on an existing fd. Remove would be meaningless for this case. Modify will re-read available I/O. Q9 Do I need to continuously read/write an fd until EAGAIN when using the EPOLLET flag ( Edge Triggered behaviour ) ? A9 No you don't. Receiving an event from epoll_wait(2) should sug- gest to you that such file descriptor is ready for the requested I/O operation. You have simply to consider it ready until you will receive the next EAGAIN. When and how you will use such file descriptor is entirely up to you. Also, the condition that the read/write I/O space is exhausted can be detected by check- ing the amount of data read/write from/to the target file descriptor. For example, if you call read(2) by asking to read a certain amount of data and read(2) returns a lower number of bytes, you can be sure to have exhausted the read I/O space for such file descriptor. Same is valid when writing using the write(2) function. POSSIBLE PITFALLS AND WAYS TO AVOID THEM o Starvation ( Edge Triggered ) If there is a large amount of I/O space, it is possible that by trying to drain it the other files will not get processed causing starvation. This is not specific to epoll. The solution is to maintain a ready list and mark the file descriptor as ready in its associated data structure, thereby allowing the appli- cation to remember which files need to be processed but still round robin amongst all the ready files. This also supports ignoring subse- quent events you receive for fd's that are already ready. o If using an event cache... If you use an event cache or store all the fd's returned from epoll_wait(2), then make sure to provide a way to mark its closure dynamically (ie- caused by a previous event's processing). Suppose you receive 100 events from epoll_wait(2), and in eventi #47 a condition causes event #13 to be closed. If you remove the structure and close() the fd for event #13, then your event cache might still say there are events waiting for that fd causing confusion. One solution for this is to call, during the processing of event 47, epoll_ctl(EPOLL_CTL_DEL) to delete fd 13 and close(), then mark its associated data structure as removed and link it to a cleanup list. If you find another event for fd 13 in your batch processing, you will discover the fd had been previously removed and there will be no confu- sion. CONFORMING TO epoll(4) is a new API introduced in Linux kernel 2.5.44. Its interface should be finalized in Linux kernel 2.5.66. SEE ALSO epoll_create(2) epoll_ctl(2) epoll_wait(2) Linux 23 October 2002 EPOLL(4)

true 2008-05-21 14:43 鍙戣〃璇勮
]]>
无码人妻精品一区二区三区久久久| 国内精品伊人久久久久影院对白| 91久久精品国产成人久久| 久久天天躁狠狠躁夜夜躁2014| 国产精品成人久久久久三级午夜电影 | 久久99精品久久久久久| 天天躁日日躁狠狠久久| 中文字幕热久久久久久久| 97久久国产综合精品女不卡| 亚洲精品乱码久久久久久蜜桃图片 | 国产精品久久久福利| 国产精品一区二区久久| 国产精品久久久久久久久免费| 2021久久国自产拍精品| 久久不射电影网| 久久精品18| 久久精品无码一区二区WWW| 久久亚洲精品无码aⅴ大香| 久久天天躁狠狠躁夜夜网站 | 国产福利电影一区二区三区久久老子无码午夜伦不 | 无码人妻少妇久久中文字幕蜜桃| 一本色道久久HEZYO无码| 久久大香香蕉国产| 国产亚州精品女人久久久久久| 久久久免费观成人影院| 亚洲精品午夜国产VA久久成人| 精品久久久久久无码专区不卡| 色成年激情久久综合| 污污内射久久一区二区欧美日韩| 国内精品九九久久精品 | 国产福利电影一区二区三区久久久久成人精品综合 | 丁香久久婷婷国产午夜视频| 久久综合伊人77777麻豆| 久久综合综合久久综合| 伊人久久大香线蕉影院95| 久久国产午夜精品一区二区三区| 7777精品伊人久久久大香线蕉| 久久国产一区二区| 久久久久亚洲av成人网人人软件| 99麻豆久久久国产精品免费| 亚洲精品成人网久久久久久|