{"id":176,"date":"2016-04-09T17:46:16","date_gmt":"2016-04-09T17:46:16","guid":{"rendered":""},"modified":"2016-04-09T17:46:16","modified_gmt":"2016-04-09T17:46:16","slug":"","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=176","title":{"rendered":"I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f"},"content":{"rendered":"<p>\n\t<span style=\"font-size:14px;\">&nbsp; &nbsp; \u5728I\/O\u591a\u8def\u590d\u7528\u4e2d\uff0c\u6d88\u606f\u6709\u4e24\u79cd\u4e0d\u540c\u7684\u89e6\u53d1\u65b9\u5f0f\uff0c\u5206\u522b\u662f\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">&nbsp;&nbsp;&nbsp;&nbsp;\u6c34\u5e73\u89e6\u53d1(level-triggered\uff0c\u4e5f\u88ab\u79f0\u4e3a\u6761\u4ef6\u89e6\u53d1)LT: &nbsp;\u53ea\u8981\u6ee1\u8db3\u6761\u4ef6\uff0c\u5c31\u89e6\u53d1\u4e00\u4e2a\u4e8b\u4ef6(\u53ea\u8981\u6709\u6570\u636e\u6ca1\u6709\u88ab\u83b7\u53d6\uff0c\u5185\u6838\u5c31\u4e0d\u65ad\u901a\u77e5\u4f60) \u3002<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">&nbsp;&nbsp;&nbsp;&nbsp;\u8fb9\u7f18\u89e6\u53d1(edge-triggered)ET: \u6bcf\u5f53\u72b6\u6001\u53d8\u5316\u65f6\uff0c\u89e6\u53d1\u4e00\u4e2a\u4e8b\u4ef6\u3002<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><br \/>\n<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\"><\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">&nbsp; &nbsp; \u4e00\u822c\u5728I\/O\u591a\u8def\u590d\u7528\u4e2d\uff0c\u6709\u4e09\u4e2a\u7ecf\u5178\u7684\u6a21\u578b\uff0c\u5206\u522b\u662f\uff1aselect\u3001poll\u548cepoll\u3002\u4f46\u662f\u5bf9\u4e8e\u540e\u4e24\u8005\uff0c\u5728\u5e94\u7528\u65f6\u90fd\u4f1a\u6709\u660e\u786e\u7684\u53c2\u6570\u6765\u8bbe\u7f6e\u6d88\u606f\u89e6\u53d1\u7c7b\u578b\uff0c\u552f\u72ecselect\u6ca1\u6709\u8fd9\u79cd\u53ef\u9009\u7684\u8bbe\u7f6e\uff0c\u90a3\u4e48select\u7a76\u7adf\u5c5e\u4e8e\u54ea\u79cd\u89e6\u53d1\u5f62\u5f0f\uff0c\u4e0d\u59a8\u505a\u4e2a\u5b9e\u9a8c\u3002<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">&nbsp; &nbsp; \u5b9e\u9a8c\u7684\u57fa\u672c\u601d\u8def\u5c31\u662f\uff0cserver\u901a\u8fc7select\u6a21\u578b\u6765\u76d1\u542c\u4e8b\u4ef6\uff0c\u82e5\u6709\u4e8b\u4ef6\u53d1\u751f\uff0c\u5219\u4e00\u6b21\u53ea\u63a5\u6536\u4e00\u4e2a\u5b57\u8282\u7684\u6570\u636e\uff0c\u800cclient\u4f1a\u4e00\u6b21\u6027\u7684\u5411server\u53d1\u9001\u5927\u4e8e1\u5b57\u8282\u7684\u62a5\u6587\uff0c\u82e5server\u4e0d\u65ad\u7684\u89e6\u53d1\u4e86select\u7684\u6d88\u606f\u901a\u77e5\uff0c\u5219\u4f1a\u5c06client\u53d1\u9001\u6765\u7684\u6240\u6709\u6570\u636e\u5168\u90e8\u63a5\u6536\uff0c\u4f46\u82e5server\u53ea\u89e6\u53d1\u4e86\u4e00\u6b21\u6d88\u606f\uff0c\u5219\u4e0d\u4f1a\u5c06\u5b8c\u6574\u7684\u6570\u636e\u590d\u5236\u5230\u7528\u6237\u5185\u5b58\u4e2d\uff0c\u7531\u6b64\u5c31\u53ef\u5224\u65adselect\u7684\u6d88\u606f\u89e6\u53d1\u7c7b\u578b\u3002<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">&nbsp; &nbsp;&nbsp;<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">\u4e0b\u9762\u7ed9\u51fa\u5b9e\u9a8c\u4ee3\u7801\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:12px;\">\/\/Server<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:12px;\">#include &lt;stdio.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;stdlib.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;string.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;sys\/socket.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;sys\/types.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;sys\/select.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;time.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;arpa\/inet.h&gt;<\/span><\/p>\n<p><span style=\"font-size:12px;\">int main()<\/span><br \/>\n<span style=\"font-size:12px;\">{<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; struct sockaddr_in localAddr;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; struct sockaddr_in clientAddr;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; struct timeval timeo;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; int listenSoc;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; int clientSoc;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; int addrLen;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; fd_set fdRead;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; char recvBuff[100];<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; memset(&amp;localAddr,NULL,sizeof(localAddr));<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; memset(&amp;clientAddr,NULL,sizeof(clientAddr));<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; memset(&amp;timeo,NULL,sizeof(timeo));<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; timeo.tv_sec=1;<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; localAddr.sin_addr.s_addr=INADDR_ANY;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; localAddr.sin_port=htons(7777);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; localAddr.sin_family=AF_INET;<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; listenSoc=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; if(listenSoc==-1)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;create socket failed.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; return -1;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; if(bind(listenSoc,(struct sockaddr *)&amp;localAddr,sizeof(localAddr))!=0)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;bind addr failed.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; return -1;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; if(listen(listenSoc,SOMAXCONN)!=0)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;listen socket failed.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; return -1;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; addrLen=sizeof(clientAddr);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; clientSoc=accept(listenSoc,(struct sockaddr *)&amp;clientAddr,&amp;addrLen);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; if(clientSoc==-1)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;accept conn failed.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; return -1;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; while(1)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; FD_ZERO(&amp;fdRead);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; FD_SET(clientSoc,&amp;fdRead);<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; if(select(clientSoc+1,&amp;fdRead,NULL,NULL,&amp;timeo)&lt;=0)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; if(FD_ISSET(clientSoc,&amp;fdRead))<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; memset(recvBuff,NULL,sizeof(recvBuff));<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(recv(clientSoc,recvBuff,1,0)&lt;=0)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;close conn.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 0;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;%s&#8221;,recvBuff);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; }<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; return 0;<\/span><br \/>\n<span style=\"font-size:12px;\">}<\/span><\/p>\n<p>\n<span style=\"font-size:12px;\">\/\/Client<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:12px;\">#include &lt;stdio.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;stdlib.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;string.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;sys\/socket.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;sys\/types.h&gt;<\/span><br \/>\n<span style=\"font-size:12px;\">#include &lt;arpa\/inet.h&gt;<\/span><\/p>\n<p><span style=\"font-size:12px;\">int main()<\/span><br \/>\n<span style=\"font-size:12px;\">{<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; struct sockaddr_in servAddr;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; int servSoc;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; char *sendStr=&#8221;Hello,I&#8217;m client.\\n&#8221;;<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; memset(&amp;servAddr,NULL,sizeof(servAddr));<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; servAddr.sin_addr.s_addr=inet_addr(&#8220;127.0.0.1&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; servAddr.sin_port=htons(7777);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; servAddr.sin_family=AF_INET;<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; servSoc=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; if(servSoc==-1)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;create socket failed.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; return -1;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; if(connect(servSoc,(struct sockaddr *)&amp;servAddr,sizeof(servAddr))!=0)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;conn failed.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; return -1;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; if(send(servSoc,sendStr,strlen(sendStr),0)&lt;=0)<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; {<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;send failed.\\n&#8221;);<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; &nbsp; &nbsp; return -1;<\/span><br \/>\n<span style=\"font-size:12px;\">&nbsp; &nbsp; }<\/span><\/p>\n<p><span style=\"font-size:12px;\">&nbsp; &nbsp; return 0;<\/span><br \/>\n<span style=\"font-size:12px;\">}<\/span><\/p>\n<p>\n<span style=\"font-size:14px;\">\u5b9e\u9a8c\u7ed3\u679c\uff1a<\/span>\n<\/p>\n<p>\n\t<a target=\"_blank\" href=\"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg\" data-rel=\"penci-gallery-image-content\"  id=\"ematt:383\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg\" title=\"\u70b9\u51fb\u67e5\u770b\u539f\u56fe\" alt=\"20160410010643.jpg\" border=\"0\" width=\"635\" height=\"88\" \/><\/a>\n<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">\u7531\u6b64\u53ef\u5f97\uff0cselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f\u4e3a\u6c34\u5e73\u89e6\u53d1\u3002<\/span><br \/>\n<span style=\"font-size:14px;\"><\/span>\n<\/p>\n<p>\n\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\n\t<span style=\"font-size:14px;\">&nbsp; &nbsp; \u5728I\/O\u591a\u8def\u590d\u7528\u4e2d\uff0c\u6d88\u606f\u6709\u4e24\u79cd\u4e0d\u540c\u7684\u89e6\u53d1\u65b9\u5f0f\uff0c\u5206\u522b\u662f\uff1a<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">&nbsp;&nbsp;&nbsp;&nbsp;\u6c34\u5e73\u89e6\u53d1(level-triggered\uff0c\u4e5f\u88ab\u79f0\u4e3a\u6761\u4ef6\u89e6\u53d1)LT: &nbsp;\u53ea\u8981\u6ee1\u8db3\u6761\u4ef6\uff0c\u5c31\u89e6\u53d1\u4e00\u4e2a\u4e8b\u4ef6(\u53ea\u8981\u6709\u6570\u636e\u6ca1\u6709\u88ab\u83b7\u53d6\uff0c\u5185\u6838\u5c31\u4e0d\u65ad\u901a\u77e5\u4f60) \u3002<\/span>\n<\/p>\n<p>\n\t<span style=\"font-size:14px;\">&nbsp;&nbsp;&nbsp;&nbsp;\u8fb9\u7f18\u89e6\u53d1(edge-triggered)ET: \u6bcf\u5f53\u72b6\u6001\u53d8\u5316\u65f6\uff0c\u89e6\u53d1&#8230;<\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[324],"tags":[],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f - Wayne&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/weizn.net\/?p=176\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"&nbsp; &nbsp; \u5728I\/O\u591a\u8def\u590d\u7528\u4e2d\uff0c\u6d88\u606f\u6709\u4e24\u79cd\u4e0d\u540c\u7684\u89e6\u53d1\u65b9\u5f0f\uff0c\u5206\u522b\u662f\uff1a    &nbsp;&nbsp;&nbsp;&nbsp;\u6c34\u5e73\u89e6\u53d1(level-triggered\uff0c\u4e5f\u88ab\u79f0\u4e3a\u6761\u4ef6\u89e6\u53d1)LT: &nbsp;\u53ea\u8981\u6ee1\u8db3\u6761\u4ef6\uff0c\u5c31\u89e6\u53d1\u4e00\u4e2a\u4e8b\u4ef6(\u53ea\u8981\u6709\u6570\u636e\u6ca1\u6709\u88ab\u83b7\u53d6\uff0c\u5185\u6838\u5c31\u4e0d\u65ad\u901a\u77e5\u4f60) \u3002    &nbsp;&nbsp;&nbsp;&nbsp;\u8fb9\u7f18\u89e6\u53d1(edge-triggered)ET: \u6bcf\u5f53\u72b6\u6001\u53d8\u5316\u65f6\uff0c\u89e6\u53d1...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=176\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-09T17:46:16+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zinan\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/weizn.net\/#website\",\"url\":\"http:\/\/weizn.net\/\",\"name\":\"Wayne&#039;s Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/weizn.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/weizn.net\/?p=176#primaryimage\",\"inLanguage\":\"zh-Hans\",\"url\":\"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg\",\"contentUrl\":\"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=176#webpage\",\"url\":\"http:\/\/weizn.net\/?p=176\",\"name\":\"I\/O\\u591a\\u8def\\u590d\\u7528\\u4e2dselect\\u6a21\\u578b\\u7684\\u6d88\\u606f\\u89e6\\u53d1\\u5f62\\u5f0f - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=176#primaryimage\"},\"datePublished\":\"2016-04-09T17:46:16+00:00\",\"dateModified\":\"2016-04-09T17:46:16+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=176#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=176\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=176#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"I\/O\\u591a\\u8def\\u590d\\u7528\\u4e2dselect\\u6a21\\u578b\\u7684\\u6d88\\u606f\\u89e6\\u53d1\\u5f62\\u5f0f\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=176#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=176#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"I\/O\\u591a\\u8def\\u590d\\u7528\\u4e2dselect\\u6a21\\u578b\\u7684\\u6d88\\u606f\\u89e6\\u53d1\\u5f62\\u5f0f\",\"datePublished\":\"2016-04-09T17:46:16+00:00\",\"dateModified\":\"2016-04-09T17:46:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=176#webpage\"},\"wordCount\":616,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"image\":{\"@id\":\"http:\/\/weizn.net\/?p=176#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg\",\"articleSection\":[\"C\/C++\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=176#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\",\"name\":\"zinan\",\"logo\":{\"@id\":\"http:\/\/weizn.net\/#personlogo\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f - Wayne&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/weizn.net\/?p=176","og_locale":"zh_CN","og_type":"article","og_title":"I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f - Wayne&#039;s Blog","og_description":"&nbsp; &nbsp; \u5728I\/O\u591a\u8def\u590d\u7528\u4e2d\uff0c\u6d88\u606f\u6709\u4e24\u79cd\u4e0d\u540c\u7684\u89e6\u53d1\u65b9\u5f0f\uff0c\u5206\u522b\u662f\uff1a    &nbsp;&nbsp;&nbsp;&nbsp;\u6c34\u5e73\u89e6\u53d1(level-triggered\uff0c\u4e5f\u88ab\u79f0\u4e3a\u6761\u4ef6\u89e6\u53d1)LT: &nbsp;\u53ea\u8981\u6ee1\u8db3\u6761\u4ef6\uff0c\u5c31\u89e6\u53d1\u4e00\u4e2a\u4e8b\u4ef6(\u53ea\u8981\u6709\u6570\u636e\u6ca1\u6709\u88ab\u83b7\u53d6\uff0c\u5185\u6838\u5c31\u4e0d\u65ad\u901a\u77e5\u4f60) \u3002    &nbsp;&nbsp;&nbsp;&nbsp;\u8fb9\u7f18\u89e6\u53d1(edge-triggered)ET: \u6bcf\u5f53\u72b6\u6001\u53d8\u5316\u65f6\uff0c\u89e6\u53d1...","og_url":"http:\/\/weizn.net\/?p=176","og_site_name":"Wayne&#039;s Blog","article_published_time":"2016-04-09T17:46:16+00:00","og_image":[{"url":"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg"}],"twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zinan","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"http:\/\/weizn.net\/#website","url":"http:\/\/weizn.net\/","name":"Wayne&#039;s Blog","description":"","publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/weizn.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"ImageObject","@id":"http:\/\/weizn.net\/?p=176#primaryimage","inLanguage":"zh-Hans","url":"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg","contentUrl":"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg"},{"@type":"WebPage","@id":"http:\/\/weizn.net\/?p=176#webpage","url":"http:\/\/weizn.net\/?p=176","name":"I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/weizn.net\/?p=176#primaryimage"},"datePublished":"2016-04-09T17:46:16+00:00","dateModified":"2016-04-09T17:46:16+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=176#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=176"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=176#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=176#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=176#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"I\/O\u591a\u8def\u590d\u7528\u4e2dselect\u6a21\u578b\u7684\u6d88\u606f\u89e6\u53d1\u5f62\u5f0f","datePublished":"2016-04-09T17:46:16+00:00","dateModified":"2016-04-09T17:46:16+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=176#webpage"},"wordCount":616,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"image":{"@id":"http:\/\/weizn.net\/?p=176#primaryimage"},"thumbnailUrl":"http:\/\/www.weizn.net\/content\/uploadfile\/201604\/2b671460221074.jpg","articleSection":["C\/C++"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=176#respond"]}]},{"@type":["Person","Organization"],"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264","name":"zinan","logo":{"@id":"http:\/\/weizn.net\/#personlogo"}}]}},"_links":{"self":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176"}],"version-history":[{"count":0,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}