{"id":84,"date":"2014-02-20T09:47:01","date_gmt":"2014-02-20T09:47:01","guid":{"rendered":""},"modified":"2014-02-20T09:47:01","modified_gmt":"2014-02-20T09:47:01","slug":"","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=84","title":{"rendered":"[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b"},"content":{"rendered":"<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t<strong>\u4e00\uff0e\u91cd\u53e0\u6a21\u578b\u7684\u4f18\u70b9<\/strong>\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t1.\u53ef\u4ee5\u8fd0\u884c\u5728\u652f\u6301Winsock2\u7684\u6240\u6709Windows\u5e73\u53f0 ,\u800c\u4e0d\u50cf\u5b8c\u6210\u7aef\u53e3\u53ea\u662f\u652f\u6301NT\u7cfb\u7edf\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t2.\u6bd4\u8d77\u963b\u585e\u3001select\u3001WSAAsyncSelect\u4ee5\u53caWSAEventSelect\u7b49\u6a21\u578b\uff0c\u91cd\u53e0I\/O(Overlapped I\/O)\u6a21\u578b\u4f7f\u5e94\u7528\u7a0b\u5e8f\u80fd\u8fbe\u5230\u66f4\u4f73\u7684\u7cfb\u7edf\u6027\u80fd\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u56e0\u4e3a\u5b83\u548c\u8fd94\u79cd\u6a21\u578b\u4e0d\u540c\u7684\u662f\uff0c\u4f7f\u7528\u91cd\u53e0\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u901a\u77e5\u7f13\u51b2\u533a\u6536\u53d1\u7cfb\u7edf\u76f4\u63a5\u4f7f\u7528\u6570\u636e\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u5e94\u7528\u7a0b\u5e8f\u6295\u9012\u4e86\u4e00\u4e2a10KB\u5927\u5c0f\u7684\u7f13\u51b2\u533a\u6765\u63a5\u6536\u6570\u636e\uff0c\u4e14\u6570\u636e\u5df2\u7ecf\u5230\u8fbe\u5957\u63a5\u5b57\uff0c\u5219\u8be5\u6570\u636e\u5c06\u76f4\u63a5\u88ab\u62f7\u8d1d\u5230\u6295\u9012\u7684\u7f13\u51b2\u533a\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u800c\u8fd94\u79cd\u6a21\u578b\u79cd\uff0c\u6570\u636e\u5230\u8fbe\u5e76\u62f7\u8d1d\u5230\u5355\u5957\u63a5\u5b57\u63a5\u6536\u7f13\u51b2\u533a\u4e2d\uff0c\u6b64\u65f6\u5e94\u7528\u7a0b\u5e8f\u4f1a\u88ab\u544a\u77e5\u53ef\u4ee5\u8bfb\u5165\u7684\u5bb9\u91cf\u3002\u5f53\u5e94\u7528\u7a0b\u5e8f\u8c03\u7528\u63a5\u6536\u51fd\u6570\u4e4b\u540e\uff0c\u6570\u636e\u624d\u4ece\u5355\u5957\u63a5\u5b57\u7f13\u51b2\u533a\u62f7\u8d1d\u5230\u5e94\u7528\u7a0b\u5e8f\u7684\u7f13\u51b2\u533a\uff0c\u5dee\u522b\u5c31\u4f53\u73b0\u51fa\u6765\u4e86\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t3.\u4ece\u300awindows\u7f51\u7edc\u7f16\u7a0b\u300b\u4e2d\u63d0\u4f9b\u7684\u8bd5\u9a8c\u7ed3\u679c\u4e2d\u53ef\u4ee5\u770b\u5230\uff0c\u5728\u4f7f\u7528\u4e86P4 1.7G<br \/>\nXero\u5904\u7406\u5668(CPU\u5f88\u5f3a\u554a)\u4ee5\u53ca768MB\u7684\u56de\u5e94\u670d\u52a1\u5668\u4e2d\uff0c\u6700\u5927\u53ef\u4ee5\u5904\u74064\u4e07\u591a\u4e2aSOCKET\u8fde\u63a5\uff0c\u5728\u5904\u74061\u4e072\u5343\u4e2a\u8fde\u63a5\u7684\u65f6\u5019CPU\u5360\u7528\u7387\u624d40%<br \/>\n \u5de6\u53f3 \u2015\u2015 \u975e\u5e38\u597d\u7684\u6027\u80fd\uff0c\u5df2\u7ecf\u76f4\u903c\u5b8c\u6210\u7aef\u53e3\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t<strong>\u4e8c\uff0e\u91cd\u53e0\u6a21\u578b\u7684\u57fa\u672c\u539f\u7406<\/strong>\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000 \u8bf4\u4e86\u8fd9\u4e48\u591a\u7684\u597d\u5904\uff0c\u4f60\u4e00\u5b9a\u4e5f\u8dc3\u8dc3\u6b32\u8bd5\u4e86\u5427\uff0c\u4e0d\u8fc7\u6211\u4eec\u8fd8\u662f\u8981\u5148\u63d0\u4e00\u4e0b\u91cd\u53e0\u6a21\u578b\u7684\u57fa\u672c\u539f\u7406\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000 \u6982\u62ec\u4e00\u70b9\u8bf4\uff0c\u91cd\u53e0\u6a21\u578b\u662f\u8ba9\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u91cd\u53e0\u6570\u636e\u7ed3\u6784(WSAOVERLAPPED)\uff0c\u4e00\u6b21\u6295\u9012\u4e00\u4e2a\u6216\u591a\u4e2aWinsock I\/O\u8bf7\u6c42\u3002\u9488\u5bf9\u8fd9\u4e9b\u63d0\u4ea4\u7684\u8bf7\u6c42\uff0c\u5728\u5b83\u4eec\u5b8c\u6210\u4e4b\u540e\uff0c\u5e94\u7528\u7a0b\u5e8f\u4f1a\u6536\u5230\u901a\u77e5\uff0c\u4e8e\u662f\u5c31\u53ef\u4ee5\u901a\u8fc7\u81ea\u5df1\u53e6\u5916\u7684\u4ee3\u7801\u6765\u5904\u7406\u8fd9\u4e9b\u6570\u636e\u4e86\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000 \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6709\u4e24\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u7528\u6765\u7ba1\u7406\u91cd\u53e0IO\u8bf7\u6c42\u7684\u5b8c\u6210\u60c5\u51b5\uff08\u5c31\u662f\u8bf4\u63a5\u5230\u91cd\u53e0\u64cd\u4f5c\u5b8c\u6210\u7684\u901a\u77e5\uff09\uff1a\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t1.\u3000\u4e8b\u4ef6\u5bf9\u8c61\u901a\u77e5(event object notification)\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t2.\u3000\u5b8c\u6210\u4f8b\u7a0b(completion routines) ,\u6ce8\u610f\uff0c\u8fd9\u91cc\u5e76\u4e0d\u662f\u5b8c\u6210\u7aef\u53e3\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u800c\u672c\u6587\u53ea\u662f\u8bb2\u8ff0\u5982\u4f55\u6765\u4f7f\u7528\u4e8b\u4ef6\u901a\u77e5\u7684\u7684\u65b9\u6cd5\u5b9e\u73b0\u91cd\u53e0IO\u6a21\u578b\uff0c\u5b8c\u6210\u4f8b\u7a0b\u7684\u65b9\u6cd5\u51c6\u5907\u653e\u5230\u4e0b\u4e00\u7bc7\u8bb2 \uff1a\uff09 (\u5185\u5bb9\u592a\u591a\u4e86\uff0c\u4e00\u7bc7\u5199\u4e0d\u5b8c\u554a) \uff0c\u5982\u6ca1\u6709\u7279\u6b8a\u8bf4\u660e\uff0c\u672c\u6587\u7684\u91cd\u53e0\u6a21\u578b\u9ed8\u8ba4\u5c31\u662f\u6307\u7684\u57fa\u4e8e\u4e8b\u4ef6\u901a\u77e5\u7684\u91cd\u53e0\u6a21\u578b\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u65e2\u7136\u662f\u57fa\u4e8e\u4e8b\u4ef6\u901a\u77e5\uff0c\u5c31\u8981\u6c42\u5c06Windows\u4e8b\u4ef6\u5bf9\u8c61\u4e0eWSAOVERLAPPED\u7ed3\u6784\u5173\u8054\u5728\u4e00\u8d77\uff08WSAOVERLAPPED\u7ed3\u6784\u4e2d\u4e13\u95e8\u6709\u5bf9\u5e94\u7684\u53c2<br \/>\n\u6570\uff09\uff0c\u901a\u4fd7\u4e00\u70b9\u8bb2\uff0c\u5c31\u662f\u3002\u3002\u3002\u3002\u5bf9\u4e86\uff0c\u5fd8\u4e86\u8bf4\u4e86\uff0c\u65e2\u7136\u8981\u4f7f\u7528\u91cd\u53e0\u7ed3\u6784\uff0c\u6211\u4eec\u5e38\u7528\u7684send, sendto, recv,<br \/>\nrecvfrom\u4e5f\u90fd\u8981\u88abWSASend, WSASendto, WSARecv, WSARecvFrom\u66ff\u6362\u6389\u4e86\uff0c<br \/>\n\u5b83\u4eec\u7684\u7528\u6cd5\u6211\u540e\u9762\u4f1a\u8bb2\u5230\uff0c\u8fd9\u91cc\u53ea\u9700\u8981\u6ce8\u610f\u4e00\u70b9\uff0c\u5b83\u4eec\u7684\u53c2\u6570\u4e2d\u90fd\u6709\u4e00\u4e2aOverlapped\u53c2\u6570\uff0c\u6211\u4eec\u53ef\u4ee5\u5047\u8bbe\u662f\u628a\u6211\u4eec\u7684WSARecv\u8fd9\u6837\u7684\u64cd\u4f5c\u64cd\u4f5c\u201c\u7ed1<br \/>\n\u5b9a\u201d\u5230\u8fd9\u4e2a\u91cd\u53e0\u7ed3\u6784\u4e0a\uff0c\u63d0\u4ea4\u4e00\u4e2a\u8bf7\u6c42\uff0c\u5176\u4ed6\u7684\u4e8b\u60c5\u5c31\u4ea4\u7ed9\u91cd\u53e0\u7ed3\u6784\u53bb\u64cd\u5fc3\uff0c\u800c\u5176\u4e2d\u91cd\u53e0\u7ed3\u6784\u53c8\u8981\u4e0eWindows\u7684\u4e8b\u4ef6\u5bf9\u8c61\u201c\u7ed1\u5b9a\u201d\u5728\u4e00\u8d77\uff0c\u8fd9\u6837\u6211\u4eec\u8c03\u7528\u5b8c<br \/>\nWSARecv\u4ee5\u540e\u5c31\u53ef\u4ee5\u201c\u5750\u4eab\u5176\u6210\u201d\uff0c\u7b49\u5230\u91cd\u53e0\u64cd\u4f5c\u5b8c\u6210\u4ee5\u540e\uff0c\u81ea\u7136\u4f1a\u6709\u4e0e\u4e4b\u5bf9\u5e94\u7684\u4e8b\u4ef6\u6765\u901a\u77e5\u6211\u4eec\u64cd\u4f5c\u5b8c\u6210\uff0c\u7136\u540e\u6211\u4eec\u5c31\u53ef\u4ee5\u6765\u6839\u636e\u91cd\u53e0\u64cd\u4f5c\u7684\u7ed3\u679c\u53d6\u5f97\u6211\u4eec<br \/>\n\u60f3\u8981\u5fb7\u6570\u636e\u4e86\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000 \u4e5f\u8bb8\u8bf4\u4e86\u534a\u5929\u4f60\u8fd8\u662f\u4e0d\u5927\u660e\u767d\uff0c\u90a3\u5c31\u7ee7\u7eed\u5f80\u540e\u9762\u770b\u5427\u3002\u3002\u3002\u3002\u3002\u3002\u3002-_-b\uff0c\u8bed\u8a00\u8868\u8fbe\u80fd\u529b\u6709\u9650\u554a~~~\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t<strong>\u4e09\uff0e\u5173\u4e8e\u91cd\u53e0\u6a21\u578b\u7684\u57fa\u7840\u77e5\u8bc6<\/strong>\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000 \u4e0b\u9762\u6765\u4ecb\u7ecd\u5e76\u4e3e\u4f8b\u8bf4\u660e\u4e00\u4e0b\u7f16\u5199\u91cd\u53e0\u6a21\u578b\u7684\u7a0b\u5e8f\u4e2d\u5c06\u4f1a\u4f7f\u7528\u5230\u7684\u51e0\u4e2a\u5173\u952e\u51fd\u6570\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t1. WSAOVERLAPPED\u7ed3\u6784\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u8fd9\u4e2a\u7ed3\u6784\u81ea\u7136\u662f\u91cd\u53e0\u6a21\u578b\u91cc\u7684\u6838\u5fc3\uff0c\u5b83\u662f\u8fd9\u4e48\u5b9a\u4e49\u7684\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\ttypedef struct _WSAOVERLAPPED {\u3000\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000 DWORD Internal;\u3000\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000 DWORD InternalHigh;\u3000\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000 DWORD Offset;\u3000\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000 DWORD OffsetHigh;\u3000\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000 WSAEVENT hEvent;\u3000\u3000\u3000\u3000\u3000 \/\/ \u552f\u4e00\u9700\u8981\u5173\u6ce8\u7684\u53c2\u6570\uff0c\u7528\u6765\u5173\u8054WSAEvent\u5bf9\u8c61<br \/>\n} WSAOVERLAPPED, *LPWSAOVERLAPPED;<br \/>\n\u6211\u4eec\u9700\u8981\u628aWSARecv\u7b49\u64cd\u4f5c\u6295\u9012\u5230\u4e00\u4e2a\u91cd\u53e0\u7ed3\u6784\u4e0a\uff0c\u800c\u6211\u4eec\u53c8\u9700\u8981\u4e00\u4e2a\u4e0e\u91cd\u53e0\u7ed3\u6784\u201c\u7ed1\u5b9a\u201d\u5728\u4e00\u8d77\u7684\u4e8b\u4ef6\u5bf9\u8c61\u6765\u901a\u77e5\u6211\u4eec\u64cd\u4f5c\u7684\u5b8c\u6210\uff0c\u770b\u5230\u4e86\u548chEvent\u53c2\u6570\uff0c\u4e0d\u7528\u6211\u8bf4\u4f60\u4eec\u4e5f\u8be5\u77e5\u9053\u5982\u4f55\u6765\u6765\u628a\u4e8b\u4ef6\u5bf9\u8c61\u7ed1\u5b9a\u5230\u91cd\u53e0\u7ed3\u6784\u4e0a\u5427\uff1f\u5927\u81f4\u5982\u4e0b\uff1a<br \/>\nWSAEVENT event;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5b9a\u4e49\u4e8b\u4ef6<br \/>\nWSAOVERLAPPED AcceptOverlapped ; \/\/ \u5b9a\u4e49\u91cd\u53e0\u7ed3\u6784<br \/>\nevent = WSACreateEvent();\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5efa\u7acb\u4e00\u4e2a\u4e8b\u4ef6\u5bf9\u8c61\u53e5\u67c4<br \/>\nZeroMemory(&amp;AcceptOverlapped, sizeof(WSAOVERLAPPED)); \/\/ \u521d\u59cb\u5316\u91cd\u53e0\u7ed3\u6784<br \/>\nAcceptOverlapped.hEvent = event;\u3000\u3000\u3000 \/\/ Done !\uff01<br \/>\n\u3000&nbsp;<br \/>\n2.\u3000WSARecv\u7cfb\u5217\u51fd\u6570\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u5728\u91cd\u53e0\u6a21\u578b\u4e2d\uff0c\u63a5\u6536\u6570\u636e\u5c31\u8981\u9760\u5b83\u4e86\uff0c\u5b83\u7684\u53c2\u6570\u4e5f\u6bd4recv\u8981\u591a\uff0c\u56e0\u4e3a\u8981\u7528\u5200\u91cd\u53e0\u7ed3\u6784\u561b\uff0c\u5b83\u662f\u8fd9\u6837\u5b9a\u4e49\u7684\uff1a\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000int WSARecv(<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 SOCKET s,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/ \u5f53\u7136\u662f\u6295\u9012\u8fd9\u4e2a\u64cd\u4f5c\u7684\u5957\u63a5\u5b57<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 LPWSABUF lpBuffers,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u63a5\u6536\u7f13\u51b2\u533a\uff0c\u4e0eRecv\u51fd\u6570\u4e0d\u540c<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/\u9700\u8981\u4e00\u4e2a\u7531WSABUF\u7ed3\u6784\u6784\u6210\u7684\u6570\u7ec4<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 DWORD dwBufferCount,\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u6570\u7ec4\u4e2dWSABUF\u7ed3\u6784\u7684\u6570\u91cf<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 LPDWORD lpNumberOfBytesRecvd,\u3000 \/\/ \u5982\u679c\u63a5\u6536\u64cd\u4f5c\u7acb\u5373\u5b8c\u6210\uff0c\u8fd9\u91cc\u4f1a\u8fd4\u56de\u51fd\u6570\u8c03\u7528<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/\u63a5\u6536\u5230\u7684\u5b57\u8282\u6570<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 LPDWORD lpFlags,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u8bf4\u6765\u8bdd\u957f\u4e86\uff0c\u6211\u4eec\u8fd9\u91cc\u8bbe\u7f6e\u4e3a0 \u5373\u53ef<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 LPWSAOVERLAPPED lpOverlapped,\u3000 \/\/ \u201c\u7ed1\u5b9a\u201d\u7684\u91cd\u53e0\u7ed3\u6784<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5b8c\u6210\u4f8b\u7a0b\u4e2d\u5c06\u4f1a\u7528\u5230\u7684\u53c2\u6570\uff0c\u6211\u4eec\u8fd9\u91cc\u8bbe\u7f6e\u4e3a NULL<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 );<br \/>\n\u8fd4\u56de\u503c\uff1a<br \/>\nWSA_IO_PENDING \uff1a \u6700\u5e38\u89c1\u7684\u8fd4\u56de\u503c\uff0c\u8fd9\u662f\u8bf4\u660e\u6211\u4eec\u7684WSARecv\u64cd\u4f5c\u6210\u529f\u4e86\uff0c\u4f46\u662f<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 I\/O\u64cd\u4f5c\u8fd8\u6ca1\u6709\u5b8c\u6210\uff0c\u6240\u4ee5\u6211\u4eec\u5c31\u9700\u8981\u7ed1\u5b9a\u4e00\u4e2a\u4e8b\u4ef6\u6765\u901a\u77e5\u6211\u4eec\u64cd\u4f5c\u4f55\u65f6\u5b8c\u6210<br \/>\n\u3000&nbsp;<br \/>\n\u4e3e\u4e2a\u4f8b\u5b50\uff1a(\u53d8\u91cf\u7684\u5b9a\u4e49\u987a\u5e8f\u548c\u4e0a\u9762\u7684\u8bf4\u660e\u7684\u987a\u5e8f\u662f\u5bf9\u5e94\u7684\uff0c\u4e0b\u540c)<br \/>\nSOCKET s;<br \/>\nWSABUF DataBuf;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5b9a\u4e49WSABUF\u7ed3\u6784\u7684\u7f13\u51b2\u533a<br \/>\n\/\/ \u521d\u59cb\u5316\u4e00\u4e0bDataBuf<br \/>\n#define DATA_BUFSIZE 5096<br \/>\nchar buffer[DATA_BUFSIZE];<br \/>\nZeroMemory(buffer, DATA_BUFSIZE);<br \/>\nDataBuf.len = DATA_BUFSIZE;<br \/>\nDataBuf.buf = buffer;<br \/>\nDWORD dwBufferCount = 1, dwRecvBytes = 0, Flags = 0;<br \/>\n\/\/ \u5efa\u7acb\u9700\u8981\u7684\u91cd\u53e0\u7ed3\u6784<br \/>\nWSAOVERLAPPED AcceptOverlapped ;\/\/ \u5982\u679c\u8981\u5904\u7406\u591a\u4e2a\u64cd\u4f5c\uff0c\u8fd9\u91cc\u5f53\u7136\u9700\u8981\u4e00\u4e2a<br \/>\n\/\/ WSAOVERLAPPED\u6570\u7ec4<br \/>\nWSAEVENT event;\u3000\u3000\u3000\u3000 \/\/ \u5982\u679c\u8981\u591a\u4e2a\u4e8b\u4ef6\uff0c\u8fd9\u91cc\u5f53\u7136\u4e5f\u9700\u8981\u4e00\u4e2aWSAEVENT\u6570\u7ec4<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u9700\u8981\u6ce8\u610f\u7684\u662f\u53ef\u80fd\u4e00\u4e2aSOCKET\u540c\u65f6\u4f1a\u6709\u4e00\u4e2a\u4ee5\u4e0a\u7684\u91cd\u53e0\u8bf7\u6c42\uff0c<br \/>\n\/\/\u3000 \u4e5f\u5c31\u4f1a\u5bf9\u5e94\u4e00\u4e2a\u4ee5\u4e0a\u7684WSAEVENT<br \/>\nEvent = WSACreateEvent();<br \/>\nZeroMemory(&amp;AcceptOverlapped, sizeof(WSAOVERLAPPED));<br \/>\nAcceptOverlapped.hEvent = event;\u3000\u3000\u3000\u3000 \/\/ \u5173\u952e\u7684\u4e00\u6b65\uff0c\u628a\u4e8b\u4ef6\u53e5\u67c4\u201c\u7ed1\u5b9a\u201d\u5230\u91cd\u53e0\u7ed3\u6784\u4e0a<br \/>\n\/\/ \u4f5c\u4e86\u8fd9\u4e48\u591a\u5de5\u4f5c\uff0c\u7ec8\u4e8e\u53ef\u4ee5\u4f7f\u7528WSARecv\u6765\u628a\u6211\u4eec\u7684\u8bf7\u6c42\u6295\u9012\u5230\u91cd\u53e0\u7ed3\u6784\u4e0a\u4e86\uff0c\u547c\u3002\u3002\u3002\u3002<br \/>\nWSARecv(s, &amp;DataBuf, dwBufferCount, &amp;dwRecvBytes,&nbsp;<br \/>\n&amp;Flags, &amp;AcceptOverlapped, NULL);<br \/>\n\u5176\u4ed6\u7684\u51fd\u6570\u6211\u8fd9\u91cc\u5c31\u4e0d\u4e00\u4e00\u4ecb\u7ecd\u4e86\uff0c\u56e0\u4e3a\u6211\u4eec\u6bd5\u7adf\u8fd8\u6709MSDN\u8fd9\u4e48\u4e2a\u597d\u5e2e\u624b\uff0c\u800c\u4e14\u5728\u8bb2\u540e\u9762\u7684\u5b8c\u6210\u4f8b\u7a0b\u548c\u5b8c\u6210\u7aef\u53e3\u7684\u65f6\u5019\u6211\u8fd8\u4f1a\u8bb2\u5230\u4e00\u4e9b ^_^<br \/>\n\u3000&nbsp;<br \/>\n3.\u3000\u3000\u3000WSAWaitForMultipleEvents\u51fd\u6570\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u719f\u6089WSAEventSelect\u6a21\u578b\u7684\u670b\u53cb\u5bf9\u8fd9\u4e2a\u51fd\u6570\u80af\u5b9a\u4e0d\u4f1a\u964c\u751f\uff0c\u4e0d\u5bf9\uff0c\u5176\u5b9e\u5927\u5bb6\u90fd\u4e0d\u5e94\u8be5\u964c\u751f\uff0c\u8fd9\u4e2a\u51fd\u6570\u4e0e\u7ebf\u7a0b\u4e2d\u5e38\u7528\u7684WaitForMultipleObjects\u51fd\u6570\u6709\u4e9b\u5730\u65b9\u8fd8\u662f\u6bd4\u8f83\u50cf\u7684\uff0c\u56e0\u4e3a\u90fd\u662f\u5728\u7b49\u5f85\u67d0\u4e2a\u4e8b\u4ef6\u7684\u89e6\u53d1\u561b\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u56e0\u4e3a\u6211\u4eec\u9700\u8981\u4e8b\u4ef6\u6765\u901a\u77e5\u6211\u4eec\u91cd\u53e0\u64cd\u4f5c\u7684\u5b8c\u6210\uff0c\u6240\u4ee5\u81ea\u7136\u9700\u8981\u8fd9\u4e2a\u7b49\u5f85\u4e8b\u4ef6\u7684\u51fd\u6570\u4e0e\u4e4b\u914d\u5957\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000\u3000\u3000 DWORD WSAWaitForMultipleEvents(<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 DWORD cEvents,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u7b49\u5019\u4e8b\u4ef6\u7684\u603b\u6570\u91cf<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 const WSAEVENT* lphEvents,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u4e8b\u4ef6\u6570\u7ec4\u7684\u6307\u9488<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 BOOL fWaitAll,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/ \u8bbe\u7f6e\u4e3a TRUE\uff0c\u5219\u4e8b\u4ef6\u6570\u7ec4\u4e2d\u6240\u6709\u4e8b\u4ef6\u88ab\u4f20\u4fe1\u7684\u65f6\u5019\u51fd\u6570\u624d\u4f1a\u8fd4\u56de<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ FALSE\u5219\u4efb\u4f55\u4e00\u4e2a\u4e8b\u4ef6\u88ab\u4f20\u4fe1\u51fd\u6570\u90fd\u8981\u8fd4\u56de<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u6211\u4eec\u8fd9\u91cc\u80af\u5b9a\u662f\u8981\u8bbe\u7f6e\u4e3aFALSE\u7684<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 DWORD dwTimeout,\u3000\u3000\u3000 \/\/ \u8d85\u65f6\u65f6\u95f4\uff0c\u5982\u679c\u8d85\u65f6\uff0c\u51fd\u6570\u4f1a\u8fd4\u56de WSA_WAIT_TIMEOUT<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5982\u679c\u8bbe\u7f6e\u4e3a0\uff0c\u51fd\u6570\u4f1a\u7acb\u5373\u8fd4\u56de<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5982\u679c\u8bbe\u7f6e\u4e3a WSA_INFINITE\u53ea\u6709\u5728\u67d0\u4e00\u4e2a\u4e8b\u4ef6\u88ab\u4f20\u4fe1\u540e\u624d\u4f1a\u8fd4\u56de<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5728\u8fd9\u91cc\u4e0d\u5efa\u8bae\u8bbe\u7f6e\u4e3aWSA_INFINITE\uff0c\u56e0\u4e3a\u3002\u3002\u3002\u540e\u9762\u518d\u8bb2\u5427..-_-b<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 BOOL fAlertable\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5728\u5b8c\u6210\u4f8b\u7a0b\u4e2d\u4f1a\u7528\u5230\u8fd9\u4e2a\u53c2\u6570\uff0c\u8fd9\u91cc\u6211\u4eec\u5148\u8bbe\u7f6e\u4e3aFALSE<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 );<br \/>\n\u8fd4\u56de\u503c\uff1a<br \/>\n\u3000\u3000\u3000 WSA_WAIT_TIMEOUT \uff1a\u6700\u5e38\u89c1\u7684\u8fd4\u56de\u503c\uff0c\u6211\u4eec\u9700\u8981\u505a\u7684\u5c31\u662f\u7ee7\u7eedWait<br \/>\n\u3000\u3000\u3000 WSA_WAIT_FAILED \uff1a \u51fa\u73b0\u4e86\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5cEvents\u548clphEvents\u4e24\u4e2a\u53c2\u6570\u662f\u5426\u6709\u6548<br \/>\n\u5982\u679c\u4e8b\u4ef6\u6570\u7ec4\u4e2d\u6709\u67d0\u4e00\u4e2a\u4e8b\u4ef6\u88ab\u4f20\u4fe1\u4e86\uff0c\u51fd\u6570\u4f1a\u8fd4\u56de\u8fd9\u4e2a\u4e8b\u4ef6\u7684\u7d22\u5f15\u503c\uff0c\u4f46\u662f\u8fd9\u4e2a\u7d22\u5f15\u503c\u9700\u8981\u51cf\u53bb\u9884\u5b9a\u4e49\u503c WSA_WAIT_EVENT_0\u624d\u662f\u8fd9\u4e2a\u4e8b\u4ef6\u5728\u4e8b\u4ef6\u6570\u7ec4\u4e2d\u7684\u4f4d\u7f6e\u3002<br \/>\n\u5177\u4f53\u7684\u4f8b\u5b50\u5c31\u5148\u4e0d\u5728\u8fd9\u91cc\u4e3e\u4e86\uff0c\u540e\u9762\u8fd8\u4f1a\u8bb2\u5230<br \/>\n\u6ce8\u610f\uff1aWSAWaitForMultipleEvents\u51fd\u6570\u53ea\u80fd\u652f\u6301\u7531WSA_MAXIMUM_WAIT_EVENTS\u5bf9\u8c61\u5b9a\u4e49\u7684\u4e00\u4e2a\u6700\u5927\u503c\uff0c\u662f<br \/>\n64\uff0c\u5c31\u662f\u8bf4WSAWaitForMultipleEvents\u53ea\u80fd\u7b49\u5f8564\u4e2a\u4e8b\u4ef6\uff0c\u5982\u679c\u60f3\u540c\u65f6\u7b49\u5f85\u591a\u4e8e64\u4e2a\u4e8b\u4ef6\uff0c\u5c31\u8981<br \/>\n\u521b\u5efa\u989d\u5916\u7684\u5de5\u4f5c\u8005\u7ebf\u7a0b\uff0c\u5c31\u4e0d\u5f97\u4e0d\u53bb\u7ba1\u7406\u4e00\u4e2a\u7ebf\u7a0b\u6c60\uff0c\u8fd9\u4e00\u70b9\u5c31\u4e0d\u5982\u4e0b\u4e00\u7bc7\u8981\u8bb2\u5230\u7684\u5b8c\u6210\u4f8b\u7a0b\u6a21\u578b\u4e86\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t4.\u3000\u3000WSAGetOverlappedResult\u51fd\u6570\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u65e2\u7136\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7WSAWaitForMultipleEvents\u51fd\u6570\u6765\u5f97\u5230\u91cd\u53e0\u64cd\u4f5c\u5b8c\u6210\u7684\u901a\u77e5\uff0c\u90a3\u4e48\u6211\u4eec\u81ea\u7136\u4e5f\u9700\u8981\u4e00\u4e2a\u51fd\u6570\u6765\u67e5\u8be2\u4e00\u4e0b\u91cd\u53e0\u64cd\u4f5c\u7684\u7ed3\u679c\uff0c\u5b9a\u4e49\u5982\u4e0b\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000BOOL WSAGetOverlappedResult(<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 SOCKET s,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ SOCKET\uff0c\u4e0d\u7528\u8bf4\u4e86<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u3000\u3000\u3000 LPWSAOVERLAPPED lpOverlapped,\u3000 \/\/ \u8fd9\u91cc\u662f\u6211\u4eec\u60f3\u8981\u67e5\u8be2\u7ed3\u679c\u7684\u90a3\u4e2a\u91cd\u53e0\u7ed3\u6784\u7684\u6307\u9488<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 LPDWORD lpcbTransfer,\u3000\u3000\u3000\u3000 \/\/ \u672c\u6b21\u91cd\u53e0\u64cd\u4f5c\u7684\u5b9e\u9645\u63a5\u6536(\u6216\u53d1\u9001)\u7684\u5b57\u8282\u6570<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 BOOL fWait,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/ \u8bbe\u7f6e\u4e3aTRUE\uff0c\u9664\u975e\u91cd\u53e0\u64cd\u4f5c\u5b8c\u6210\uff0c\u5426\u5219\u51fd\u6570\u4e0d\u4f1a\u8fd4\u56de<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u8bbe\u7f6eFALSE\uff0c\u800c\u4e14\u64cd\u4f5c\u4ecd\u5904\u4e8e\u6302\u8d77\u72b6\u6001\uff0c\u90a3\u4e48\u51fd\u6570\u5c31\u4f1a\u8fd4\u56deFALSE<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u9519\u8bef\u4e3aWSA_IO_INCOMPLETE<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/\u4e0d\u8fc7\u56e0\u4e3a\u6211\u4eec\u662f\u7b49\u5f85\u4e8b\u4ef6\u4f20\u4fe1\u6765\u901a\u77e5\u6211\u4eec\u64cd\u4f5c\u5b8c\u6210\uff0c\u6240\u4ee5\u6211\u4eec\u8fd9\u91cc\u8bbe\u7f6e\u6210\u4ec0\u4e48\u90fd\u6ca1\u6709\u4f5c\u7528\u2026<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 LPDWORD lpdwFlags\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u6307\u5411DWORD\u7684\u6307\u9488\uff0c\u8d1f\u8d23\u63a5\u6536\u7ed3\u679c\u6807\u5fd7<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 );<br \/>\n\u8fd9\u4e2a\u51fd\u6570\u6ca1\u4ec0\u4e48\u96be\u7684\uff0c\u8fd9\u91cc\u6211\u4eec\u4e5f\u4e0d\u9700\u8981\u53bb\u5173\u6ce8\u5b83\u7684\u8fd4\u56de\u503c\uff0c\u76f4\u63a5\u628a\u53c2\u6570\u586b\u597d\u8c03\u7528\u5c31\u53ef\u4ee5\u4e86\uff0c\u8fd9\u91cc\u5c31\u5148\u4e0d\u4e3e\u4f8b\u4e86<br \/>\n\u552f\u4e00\u9700\u8981\u6ce8\u610f\u4e00\u4e0b\u7684\u5c31\u662f\u5982\u679cWSAGetOverlappedResult\u5b8c\u6210\u4ee5\u540e\uff0c\u7b2c\u4e09\u4e2a\u53c2\u6570\u8fd4\u56de\u662f 0 \uff0c\u5219\u8bf4\u660e\u901a\u4fe1\u5bf9\u65b9\u5df2\u7ecf\u5173\u95ed\u8fde\u63a5\uff0c\u6211\u4eec\u8fd9\u8fb9\u7684SOCKET, Event\u4e4b\u7c7b\u7684\u4e5f\u5c31\u53ef\u4ee5\u5173\u95ed\u4e86\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t<strong>\u56db\u3002\u3000\u3000\u3000\u3000 \u5b9e\u73b0\u91cd\u53e0\u6a21\u578b\u7684\u6b65\u9aa4<\/strong>\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u4f5c\u4e86\u8fd9\u4e48\u591a\u7684\u51c6\u5907\u5de5\u4f5c\uff0c\u8d39\u4e86\u8fd9\u4e48\u591a\u7684\u7b14\u58a8\uff0c\u6211\u4eec\u7ec8\u4e8e\u53ef\u4ee5\u5f00\u59cb\u7740\u624b\u7f16\u7801\u4e86\u3002\u5176\u5b9e\u6162\u6162\u7684\u4f60\u5c31\u4f1a\u660e\u767d\uff0c\u8981\u60f3\u900f\u6790\u91cd\u53e0\u7ed3\u6784\u7684\u5185\u90e8\u539f\u7406\u4e5f\u8bb8\u662f\u8981\u8d39\u70b9\u529f\u592b\uff0c\u4f46\u662f\u53ea<br \/>\n\u662f\u5b66\u4f1a\u5982\u4f55\u6765\u4f7f\u7528\u5b83\uff0c\u5374\u662f\u771f\u7684\u4e0d\u96be\uff0c\u552f\u4e00\u9700\u8981\u7406\u6e05\u601d\u8def\u7684\u5730\u65b9\u5c31\u662f\u548c\u5927\u91cf\u7684\u5ba2\u6237\u7aef\u4ea4\u4e92\u7684\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5f97\u5230\u4e8b\u4ef6\u901a\u77e5\u4ee5\u540e\uff0c\u5982\u4f55\u5f97\u77e5\u662f\u54ea\u4e00\u4e2a\u91cd\u53e0\u64cd\u4f5c\u5b8c\u6210\u4e86\uff0c\u7ee7<br \/>\n\u800c\u77e5\u9053\u7a76\u7adf\u8be5\u5bf9\u54ea\u4e00\u4e2a\u5957\u63a5\u5b57\u8fdb\u884c\u5904\u7406\uff0c\u5e94\u8be5\u53bb\u54ea\u4e2a\u7f13\u51b2\u533a\u4e2d\u7684\u53d6\u5f97\u6570\u636e\uff0ceverything will be OK^_^\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u4e0b\u9762\u6211\u4eec\u914d\u5408\u4ee3\u7801\uff0c\u6765\u4e00\u6b65\u6b65\u7684\u8bb2\u89e3\u5982\u4f55\u4eb2\u624b\u5b8c\u6210\u4e00\u4e2a\u91cd\u53e0\u6a21\u578b\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u4e00\u6b65\u3011\u5b9a\u4e49\u53d8\u91cf\u2026\u2026\u2026\u2026\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t#define DATA_BUFSIZE\u3000\u3000\u3000\u3000 4096\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u63a5\u6536\u7f13\u51b2\u533a\u5927\u5c0f<br \/>\nSOCKET\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 ListenSocket,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u76d1\u542c\u5957\u63a5\u5b57<br \/>\nAcceptSocket;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u4e0e\u5ba2\u6237\u7aef\u901a\u4fe1\u7684\u5957\u63a5\u5b57<br \/>\nWSAOVERLAPPED\u3000 AcceptOverlapped;\u3000\u3000\u3000\u3000 \/\/ \u91cd\u53e0\u7ed3\u6784\u4e00\u4e2a<br \/>\nWSAEVENT\u3000 EventArray[WSA_MAXIMUM_WAIT_EVENTS];\u3000&nbsp;<br \/>\n\/\/ \u7528\u6765\u901a\u77e5\u91cd\u53e0\u64cd\u4f5c\u5b8c\u6210\u7684\u4e8b\u4ef6\u53e5\u67c4\u6570\u7ec4<br \/>\nWSABUF\u3000\u3000\u3000\u3000 DataBuf[DATA_BUFSIZE] ;\u3000\u3000\u3000\u3000\u3000&nbsp;<br \/>\nDWORD\u3000\u3000\u3000\u3000 dwEventTotal = 0,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u7a0b\u5e8f\u4e2d\u4e8b\u4ef6\u7684\u603b\u6570<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 dwRecvBytes = 0,\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u63a5\u6536\u5230\u7684\u5b57\u7b26\u957f\u5ea6<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 Flags = 0;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ WSARecv\u7684\u53c2\u6570\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u4e8c\u6b65\u3011\u521b\u5efa\u4e00\u4e2a\u5957\u63a5\u5b57\uff0c\u5f00\u59cb\u5728\u6307\u5b9a\u7684\u7aef\u53e3\u4e0a\u76d1\u542c\u8fde\u63a5\u8bf7\u6c42\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u548c\u5176\u4ed6\u7684SOCKET\u521d\u59cb\u5316\u5168\u65e0\u4e8c\u81f4\uff0c\u76f4\u63a5\u7167\u642c\u5373\u53ef\uff0c\u5728\u6b64\u4e5f\u4e0d\u591a\u8d39\u5507\u820c\u4e86\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\u4e3a\u4e86\u4e00\u76ee\u4e86\u7136\uff0c\u6211\u53bb\u6389\u4e86\u9519\u8bef\u5904\u7406\uff0c\u5e73\u5e38\u53ef\u4e0d\u8981\u8fd9\u6837\u554a\uff0c\u5c3d\u7ba1\u8fd9\u91cc\u51fa\u9519\u7684\u51e0\u7387\u6bd4\u8f83\u5c0f\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tWSADATA wsaData;<br \/>\nWSAStartup(MAKEWORD(2,2),&amp;wsaData);<br \/>\n\u3000&nbsp;<br \/>\nListenSocket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);\u3000 \/\/\u521b\u5efaTCP\u5957\u63a5\u5b57<br \/>\n\u3000&nbsp;<br \/>\nSOCKADDR_IN ServerAddr;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/\u5206\u914d\u7aef\u53e3\u53ca\u534f\u8bae\u65cf\u5e76\u7ed1\u5b9a<br \/>\nServerAddr.sin_family=AF_INET;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000&nbsp;<br \/>\nServerAddr.sin_addr.S_un.S_addr\u3000 =htonl(INADDR_ANY);\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000&nbsp;<br \/>\nServerAddr.sin_port=htons(11111);<br \/>\n\u3000&nbsp;<br \/>\nbind(ListenSocket,(LPSOCKADDR)&amp;ServerAddr, sizeof(ServerAddr)); \/\/ \u7ed1\u5b9a\u5957\u63a5\u5b57<br \/>\n\u3000&nbsp;<br \/>\nlisten(ListenSocket, 5);\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/\u5f00\u59cb\u76d1\u542c\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u4e09\u6b65\u3011\u63a5\u53d7\u4e00\u4e2a\u5165\u7ad9\u7684\u8fde\u63a5\u8bf7\u6c42\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000AcceptSocket = accept (ListenSocket, NULL,NULL) ;&nbsp;<br \/>\n\u5f53\u7136\uff0c\u8fd9\u91cc\u662f\u6211\u5077\u61d2\uff0c\u5982\u679c\u60f3\u8981\u83b7\u5f97\u8fde\u5165\u5ba2\u6237\u7aef\u7684\u4fe1\u606f\uff08\u8bb0\u5f97\u8bba\u575b\u4e0a\u4e5f\u5e38\u6709\u4eba\u95ee\u5230\uff09\uff0caccept\u7684\u540e\u4e24\u4e2a\u53c2\u6570\u5c31\u4e0d\u8981\u7528NULL\uff0c\u800c\u662f\u8fd9\u6837\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tSOCKADDR_IN ClientAddr;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5b9a\u4e49\u4e00\u4e2a\u5ba2\u6237\u7aef\u5f97\u5730\u5740\u7ed3\u6784\u4f5c\u4e3a\u53c2\u6570<br \/>\nint addr_length=sizeof(ClientAddr);<br \/>\nAcceptSocket = accept(ListenSocket,(SOCKADDR*)&amp;ClientAddr, &amp;addr_length);<br \/>\n\/\/ \u4e8e\u662f\u4e4e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u8f7b\u677e\u5f97\u77e5\u8fde\u5165\u5ba2\u6237\u7aef\u7684\u4fe1\u606f\u4e86<br \/>\nLPCTSTR lpIP =\u3000 inet_ntoa(ClientAddr.sin_addr);\u3000\u3000\u3000\u3000\u3000 \/\/ IP<br \/>\nUINT nPort = ClientAddr.sin_port;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ Port\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u56db\u6b65\u3011\u5efa\u7acb\u5e76\u521d\u59cb\u5316\u91cd\u53e0\u7ed3\u6784\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u4e3a\u8fde\u5165\u7684\u8fd9\u4e2a\u5957\u63a5\u5b57\u65b0\u5efa\u7acb\u4e00\u4e2aWSAOVERLAPPED\u91cd\u53e0\u7ed3\u6784\uff0c\u5e76\u4e14\u8c61\u524d\u9762\u8bb2\u5230\u7684\u90a3\u6837\uff0c\u4e3a\u8fd9\u4e2a\u91cd\u53e0\u7ed3\u6784\u4ece\u4e8b\u4ef6\u53e5\u67c4\u6570\u7ec4\u91cc\u6311\u51fa\u4e00\u4e2a\u7a7a\u95f2\u7684\u5bf9\u8c61\u53e5\u67c4\u201c\u7ed1\u5b9a\u201d\u4e0a\u53bb\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\/\/ \u521b\u5efa\u4e00\u4e2a\u4e8b\u4ef6<br \/>\n\/\/ dwEventTotal\u53ef\u4ee5\u6682\u65f6\u5148\u4f5c\u4e3aEvent\u6570\u7ec4\u7684\u7d22\u5f15<br \/>\nEventArray[dwEventTotal] = WSACreateEvent();\u3000\u3000\u3000\u3000\u3000&nbsp;<br \/>\n\u3000&nbsp;<br \/>\nZeroMemory(&amp;AcceptOverlapped, sizeof(WSAOVERLAPPED));\u3000\u3000\u3000\u3000\u3000 \/\/ \u7f6e\u96f6<br \/>\nAcceptOverlapped.hEvent = EventArray[dwEventTotal];\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u5173\u8054\u4e8b\u4ef6<br \/>\n\u3000&nbsp;<br \/>\nchar buffer[DATA_BUFSIZE];<br \/>\nZeroMemory(buffer, DATA_BUFSIZE);<br \/>\nDataBuf.len = DATA_BUFSIZE;<br \/>\nDataBuf.buf = buffer;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u521d\u59cb\u5316\u4e00\u4e2aWSABUF\u7ed3\u6784<br \/>\ndwEventTotal ++;\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u603b\u6570\u52a0\u4e00\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u4e94\u6b65\u3011\u4ee5WSAOVERLAPPED\u7ed3\u6784\u4e3a\u53c2\u6570\uff0c\u5728\u5957\u63a5\u5b57\u4e0a\u6295\u9012WSARecv\u8bf7\u6c42\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u5404\u4e2a\u53d8\u91cf\u90fd\u5df2\u7ecf\u521d\u59cb\u5316OK\u4ee5\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cbSocket\u64cd\u4f5c\u4e86\uff0c\u7136\u540e\u8ba9WSAOVERLAPPED\u7ed3\u6784\u6765\u66ff\u6211\u4eec\u7ba1\u7406I\/O \u8bf7\u6c42\uff0c\u6211\u4eec\u53ea\u7528\u7b49\u5f85\u4e8b\u4ef6\u7684\u89e6\u53d1\u5c31OK\u4e86\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tif(WSARecv(AcceptSocket ,&amp;DataBuf,1,&amp;dwRecvBytes,&amp;Flags,<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 &amp; AcceptOverlapped, NULL) == SOCKET_ERROR)<br \/>\n{&nbsp;<br \/>\n\u3000\u3000 \/\/ \u8fd4\u56deWSA_IO_PENDING\u662f\u6b63\u5e38\u60c5\u51b5\uff0c\u8868\u793aIO\u64cd\u4f5c\u6b63\u5728\u8fdb\u884c\uff0c\u4e0d\u80fd\u7acb\u5373\u5b8c\u6210<br \/>\n\u3000\u3000 \/\/ \u5982\u679c\u4e0d\u662fWSA_IO_PENDING\u9519\u8bef\uff0c\u5c31\u5927\u4e8b\u4e0d\u597d\u4e86~~~~~~\uff01\uff01\uff01<br \/>\n\u3000\u3000\u3000\u3000\u3000 if(WSAGetLastError() != WSA_IO_PENDING)\u3000\u3000\u3000&nbsp;<br \/>\n\u3000\u3000\u3000\u3000\u3000 {<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \/\/ \u90a3\u5c31\u53ea\u80fd\u5173\u95ed\u5927\u5409\u4e86<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 closesocket(AcceptSocket);<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 WSACloseEvent(EventArray[dwEventTotal]);<br \/>\n\u3000\u3000\u3000\u3000\u3000 }<br \/>\n}\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u516d\u6b65\u3011 \u7528WSAWaitForMultipleEvents\u51fd\u6570\u7b49\u5f85\u91cd\u53e0\u64cd\u4f5c\u8fd4\u56de\u7684\u7ed3\u679c\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\u6211\u4eec\u524d\u9762\u5df2\u7ecf\u7ed9WSARecv\u5173\u8054\u7684\u91cd\u53e0\u7ed3\u6784\u8d4b\u4e86\u4e00\u4e2a\u4e8b\u4ef6\u5bf9\u8c61\u53e5\u67c4\uff0c\u6240\u4ee5\u6211\u4eec\u8fd9\u91cc\u8981\u7b49\u5f85\u4e8b\u4ef6\u5bf9\u8c61\u7684\u89e6\u53d1\u4e0e\u4e4b\u914d\u5408\uff0c\u800c\u4e14\u9700\u8981\u6839\u636e<br \/>\nWSAWaitForMultipleEvents\u51fd\u6570\u7684\u8fd4\u56de\u503c\u6765\u786e\u5b9a\u7a76\u7adf\u4e8b\u4ef6\u6570\u7ec4\u4e2d\u7684\u54ea\u4e00\u4e2a\u4e8b\u4ef6\u88ab\u89e6\u53d1\u4e86\uff0c\u8fd9\u4e2a\u51fd\u6570\u7684\u7528\u6cd5\u53ca\u8fd4\u56de\u503c\u8bf7\u53c2\u8003\u524d\u9762\u7684\u57fa\u7840\u77e5\u8bc6<br \/>\n\u90e8\u5206\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tDWORD dwIndex;<br \/>\n\/\/ \u7b49\u5019\u91cd\u53e0I\/O\u8c03\u7528\u7ed3\u675f<br \/>\n\/\/ \u56e0\u4e3a\u6211\u4eec\u628a\u4e8b\u4ef6\u548cOverlapped\u7ed1\u5b9a\u5728\u4e00\u8d77\uff0c\u91cd\u53e0\u64cd\u4f5c\u5b8c\u6210\u540e\u6211\u4eec\u4f1a\u63a5\u5230\u4e8b\u4ef6\u901a\u77e5<br \/>\ndwIndex = WSAWaitForMultipleEvents(dwEventTotal,&nbsp;<br \/>\nEventArray ,FALSE ,WSA_INFINITE,FALSE);<br \/>\n\/\/ \u6ce8\u610f\u8fd9\u91cc\u8fd4\u56de\u7684Index\u5e76\u975e\u662f\u4e8b\u4ef6\u5728\u6570\u7ec4\u91cc\u7684Index\uff0c\u800c\u662f\u9700\u8981\u51cf\u53bbWSA_WAIT_EVENT_0<br \/>\ndwIndex = dwIndex \u2013 WSA_WAIT_EVENT_0;\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u4e03\u6b65\u3011\u4f7f\u7528WSAResetEvent\u51fd\u6570\u91cd\u8bbe\u5f53\u524d\u8fd9\u4e2a\u7528\u5b8c\u7684\u4e8b\u4ef6\u5bf9\u8c61\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u4e8b\u4ef6\u5df2\u7ecf\u88ab\u89e6\u53d1\u4e86\u4e4b\u540e\uff0c\u5b83\u5bf9\u4e8e\u6211\u4eec\u6765\u8bf4\u5df2\u7ecf\u6ca1\u6709\u5229\u7528\u4ef7\u503c\u4e86\uff0c\u6240\u4ee5\u8981\u5c06\u5b83\u91cd\u7f6e\u4e00\u4e0b\u7559\u5f85\u4e0b\u4e00\u6b21\u4f7f\u7528\uff0c\u5f88\u7b80\u5355\uff0c\u5c31\u4e00\u6b65\uff0c\u8fde\u8fd4\u56de\u503c\u90fd\u4e0d\u7528\u8003\u8651\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tWSAResetEvent(EventArray[dwIndex]);\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u516b\u6b65\u3011\u4f7f\u7528WSAGetOverlappedResult\u51fd\u6570\u53d6\u5f97\u91cd\u53e0\u8c03\u7528\u7684\u8fd4\u56de\u72b6\u6001\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000 \u8fd9\u662f\u6211\u4eec\u6700\u5173\u5fc3\u7684\u4e8b\u60c5\uff0c\u8d39\u4e86\u90a3\u4e48\u5927\u52b2\u6295\u9012\u7684\u8fd9\u4e2a\u91cd\u53e0\u64cd\u4f5c\u7a76\u7adf\u662f\u4e2a\u4ec0\u4e48\u7ed3\u679c\u5462\uff1f\u5176\u5b9e\u5bf9\u4e8e\u672c\u6a21\u578b\u6765\u8bf4\uff0c\u552f\u4e00\u9700\u8981\u68c0\u67e5\u4e00\u4e0b\u7684\u5c31\u662f\u5bf9\u65b9\u7684Socket\u8fde\u63a5\u662f\u5426\u5df2\u7ecf\u5173\u95ed\u4e86\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tDWORD dwBytesTransferred;<br \/>\nWSAGetOverlappedResult( AcceptSocket, AcceptOverlapped ,<br \/>\n&amp;dwBytesTransferred, FALSE, &amp;Flags);<br \/>\n\/\/ \u5148\u68c0\u67e5\u901a\u4fe1\u5bf9\u65b9\u662f\u5426\u5df2\u7ecf\u5173\u95ed\u8fde\u63a5<br \/>\n\/\/ \u5982\u679c==0\u5219\u8868\u793a\u8fde\u63a5\u5df2\u7ecf\uff0c\u5219\u5173\u95ed\u5957\u63a5\u5b57<br \/>\nif(dwBytesTransferred == 0)<br \/>\n{<br \/>\n\u3000\u3000\u3000\u3000\u3000 closesocket(AcceptSocket);<br \/>\n\u3000\u3000\u3000\u3000\u3000 WSACloseEvent(EventArray[dwIndex]);\u3000\u3000\u3000 \/\/ \u5173\u95ed\u4e8b\u4ef6<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000 return;<br \/>\n}\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u4e5d\u6b65\u3011\u201c\u4eab\u53d7\u201d\u63a5\u6536\u5230\u7684\u6570\u636e\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u5982\u679c\u7a0b\u5e8f\u6267\u884c\u5230\u4e86\u8fd9\u91cc\uff0c\u90a3\u4e48\u5c31\u8bf4\u660e\u4e00\u5207\u6b63\u5e38\uff0cWSABUF\u7ed3\u6784\u91cc\u9762\u5c31\u5b58\u6709\u6211\u4eecWSARecv\u6765\u7684\u6570\u636e\u4e86\uff0c\u7ec8\u4e8e\u5230\u4e86\u5c3d\u60c5\u4eab\u7528\u6210\u679c\u7684\u65f6\u5019\u4e86\uff01\u559d\u676f\u8336\uff0c\u4f11\u606f\u4e00\u4e0b\u5427~~~^_^\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tDataBuf.buf\u5c31\u662f\u4e00\u4e2achar*\u5b57\u7b26\u4e32\u6307\u9488\uff0c\u542c\u51ed\u4f60\u7684\u5904\u7406\u5427\uff0c\u6211\u5c31\u4e0d\u591a\u8bf4\u4e86\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3010\u7b2c\u5341\u6b65\u3011\u540c\u7b2c\u4e94\u6b65\u4e00\u6837\uff0c\u5728\u5957\u63a5\u5b57\u4e0a\u7ee7\u7eed\u6295\u9012WSARecv\u8bf7\u6c42\uff0c\u91cd\u590d\u6b65\u9aa4 6 ~ 9\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u8fd9\u6837\u4e00\u8def\u4f5c\u4e0b\u6765\uff0c\u6211\u4eec\u7ec8\u4e8e\u53ef\u4ee5\u4ece\u5ba2\u6237\u7aef\u63a5\u6536\u5230\u6570\u636e\u4e86\uff0c\u4f46\u662f\u56de\u60f3\u8d77\u6765\uff0c\u5440~~~~~\uff0c\u8fd9\u6837\u5c82\u4e0d\u662f\u53ea\u80fd\u6536\u5230\u4e00\u6b21\u6570\u636e\uff0c\u7136\u540e\u7a0b\u5e8f\u4e0d\u5c31Over\u4e86\uff1f\u2026\u2026.-_-<br \/>\nb\u3000 \u6240\u4ee5\u6211\u4eec\u63a5\u4e0b\u6765\u4e0d\u5f97\u4e0d\u91cd\u590d\u4e00\u904d\u7b2c\u56db\u6b65\u548c\u7b2c\u4e94\u6b65\u7684\u5de5\u4f5c\uff0c\u518d\u6b21\u5728\u8fd9\u4e2a\u5957\u63a5\u5b57\u4e0a\u6295\u9012\u53e6\u4e00\u4e2aWSARecv\u8bf7\u6c42\uff0c\u5e76\u4e14\u4f7f\u6574\u4e2a\u8fc7\u7a0b\u5faa\u73af\u8d77\u6765\uff0care u<br \/>\nclear\uff1f\uff1f\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000 \u5927\u5bb6\u53ef\u4ee5\u53c2\u8003\u6211\u7684\u4ee3\u7801\uff0c\u5728\u8fd9\u91cc\u5c31\u5148\u4e0d\u5199\u4e86\uff0c\u56e0\u4e3a\u5404\u4f4d\u90fd\u4e00\u5b9a\u6bd4\u6211smart\uff0c\u9886\u609f\u4e86\u5173\u952e\u6240\u5728\u4ee5\u540e\uff0c\u7a0d\u4f5c\u601d\u8003\u5c31\u53ef\u4ee5\u7075\u6d3b\u53d8\u901a\u4e86\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t<strong>\u4e94. \u5ba2\u6237\u7aef\u60c5\u51b5\u7684\u6ce8\u610f\u4e8b\u9879<\/strong>\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\u5b8c\u6210\u4e86\u4e0a\u9762\u7684\u5faa\u73af\u4ee5\u540e\uff0c\u91cd\u53e0\u6a21\u578b\u5c31\u5df2\u7ecf\u57fa\u672c\u4e0a\u642d\u5efa\u597d\u4e8680%\u4e86\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u662f100%\u5462\uff1f\u56e0\u4e3a\u4ed4\u7ec6\u4e00\u56de\u60f3\u8d77\u6765\uff0c\u5440~~~~~~~\uff0c\u8fd9\u6837\u5c82\u4e0d\u662f\u53ea\u80fd\u8fde\u63a5\u4e00\u4e2a\u5ba2<br \/>\n\u6237\u7aef\uff1f\uff1f\u662f\u7684\uff0c\u5982\u679c\u53ea\u5904\u7406\u4e00\u4e2a\u5ba2\u6237\u7aef\uff0c\u90a3\u91cd\u53e0\u6a21\u578b\u5c31\u534a\u70b9\u4f18\u52bf\u4e5f\u6ca1\u6709\u4e86\uff0c\u6211\u4eec\u6b63\u662f\u8981\u4f7f\u7528\u91cd\u53e0\u6a21\u578b\u6765\u5904\u7406\u591a\u4e2a\u5ba2\u6237\u7aef\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u6240\u4ee5\u6211\u4eec\u4e0d\u5f97\u4e0d\u518d\u5bf9\u7ed3\u6784\u4f5c\u4e00\u4e9b\u6539\u52a8\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t1\uff0e \u9996\u5148\uff0c\u80af\u5b9a\u662f\u9700\u8981\u4e00\u4e2aSOCKET\u6570\u7ec4 ,\u5206\u522b\u7528\u6765\u548c\u6bcf\u4e00\u4e2aSOCKET\u901a\u4fe1\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u5176\u6b21\uff0c\u56e0\u4e3a\u91cd\u53e0\u6a21\u578b\u4e2d\u6bcf\u4e00\u4e2aSOCKET\u64cd\u4f5c\u90fd\u662f\u8981\u201c\u7ed1\u5b9a\u201d\u4e00\u4e2a\u91cd\u53e0\u7ed3\u6784\u7684\uff0c\u6240\u4ee5\u9700\u8981\u4e3a\u6bcf\u4e00\u4e2aSOCKET\u64cd\u4f5c\u642d\u914d\u4e00\u4e2aWSAOVERLAPPED\u7ed3\u6784\uff0c<br \/>\n\u4f46\u662f\u8fd9\u6837\u8bf4\u5e76\u4e0d\u4e25\u683c\uff0c\u56e0\u4e3a\u5982\u679c\u6bcf\u4e00\u4e2aSOCKET\u540c\u65f6\u53ea\u6709\u4e00\u4e2a\u64cd\u4f5c\uff0c\u6bd4\u5982WSARecv\uff0c\u90a3\u4e48\u4e00\u4e2aSOCKET\u5c31\u53ef\u4ee5\u5bf9\u5e94\u4e00\u4e2aWSAOVERLAPPED<br \/>\n\u7ed3\u6784\uff0c\u4f46\u662f\u5982\u679c\u4e00\u4e2aSOCKET\u4e0a\u4f1a\u6709WSARecv<br \/>\n\u548cWSASend\u4e24\u4e2a\u64cd\u4f5c\uff0c\u90a3\u4e48\u4e00\u4e2aSOCKET\u80af\u5b9a\u5c31\u8981\u5bf9\u5e94\u4e24\u4e2aWSAOVERLAPPED\u7ed3\u6784\uff0c\u6240\u4ee5\u6709\u591a\u5c11\u4e2aSOCKET\u64cd\u4f5c\u5c31\u4f1a\u6709\u591a\u5c11\u4e2a<br \/>\nWSAOVERLAPPED\u7ed3\u6784\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u7136\u540e\uff0c\u540c\u6837\u662f\u4e3a\u6bcf\u4e00\u4e2aWSAOVERLAPPED\u7ed3\u6784\u90fd\u8981\u642d\u914d\u4e00\u4e2aWSAEVENT\u4e8b\u4ef6\uff0c\u6240\u4ee5\u8bf4\u6709\u591a\u5c11\u4e2aSOCKET\u64cd\u4f5c\u5c31\u5e94\u8be5\u6709\u591a\u5c11\u4e2a<br \/>\nWSAOVERLAPPED\u7ed3\u6784\uff0c\u6709\u591a\u5c11\u4e2aWSAOVERLAPPED\u7ed3\u6784\u5c31\u5e94\u8be5\u6709\u591a\u5c11\u4e2aWSAEVENT\u4e8b\u4ef6\uff0c\u6700\u597d\u628aSOCKET \u2013<br \/>\nWSAOVERLAPPED \u2013 WSAEVENT\u4e09\u8005\u7684\u5173\u8054\u8d77\u6765\uff0c\u5230\u4e86\u5173\u952e\u65f6\u523b\u624d\u4f1a\u4e34\u5371\u4e0d\u4e71\uff1a\uff09\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t2\uff0e \u4e0d\u5f97\u4e0d\u5206\u4f5c\u4e24\u4e2a\u7ebf\u7a0b\uff1a\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u4e00\u4e2a\u7528\u6765\u5faa\u73af\u76d1\u542c\u7aef\u53e3\uff0c\u63a5\u6536\u8bf7\u6c42\u7684\u8fde\u63a5\uff0c\u7136\u540e\u7ed9\u5728\u8fd9\u4e2a\u5957\u63a5\u5b57\u4e0a\u914d\u5408\u4e00\u4e2aWSAOVERLAPPED\u7ed3\u6784\u6295\u9012\u7b2c\u4e00\u4e2aWSARecv\u8bf7\u6c42\uff0c\u7136\u540e\u8fdb\u5165\u7b2c\u4e8c\u4e2a\u7ebf\u7a0b\u4e2d\u7b49\u5f85\u64cd\u4f5c\u5b8c\u6210\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u7b2c\u4e8c\u4e2a\u7ebf\u7a0b\u7528\u6765\u4e0d\u505c\u7684\u5bf9WSAEVENT\u6570\u7ec4WSAWaitForMultipleEvents\uff0c\u7b49\u5f85\u4efb\u4f55\u4e00\u4e2a\u91cd\u53e0\u64cd\u4f5c\u7684\u5b8c\u6210\uff0c\u7136\u540e\u6839\u636e\u8fd4\u56de\u7684\u7d22\u5f15\u503c\u8fdb\u884c\u5904\u7406\uff0c\u5904\u7406\u5b8c\u6bd5\u4ee5\u540e\u518d\u7ee7\u7eed\u6295\u9012\u53e6\u4e00\u4e2aWSARecv\u8bf7\u6c42\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u4e00\u70b9\u7684\u662f\uff0c\u524d\u9762\u6211\u662f\u628aWSAWaitForMultipleEvents\u51fd\u6570\u7684\u53c2\u6570\u8bbe\u7f6e\u4e3aWSA_\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\tINFINITE\u7684\uff0c\u4f46\u662f\u5728\u591a\u5ba2\u6237\u7aef\u7684\u65f6\u5019\u8fd9\u6837\u5c31\u4e0dOK\u4e86\uff0c\u9700\u8981\u8bbe\u5b9a\u4e00\u4e2a\u8d85\u65f6\u65f6\u95f4\uff0c\u5982\u679c\u7b49\u5f85\u8d85\u65f6\u4e86\u518d\u91cd\u65b0<br \/>\nWSAWaitForMultipleEvents\uff0c\u56e0\u4e3aWSAWaitForMultipleEvents\u51fd\u6570\u5728\u6ca1\u6709\u89e6\u53d1\u7684\u65f6\u5019\u662f\u963b\u585e\u5728\u90a3\u91cc\u7684\uff0c\u6211\u4eec\u53ef<br \/>\n\u4ee5\u8bbe\u60f3\u4e00\u4e0b\uff0c\u8fd9\u65f6\u5982\u679c\u76d1\u542c\u7ebf\u7a0b\u5fe0\u63a5\u5165\u4e86\u65b0\u7684\u8fde\u63a5\uff0c\u81ea\u7136\u4e5f\u4f1a\u4e3a\u8fd9\u4e2a\u8fde\u63a5\u589e\u52a0\u4e00\u4e2aEvent\uff0c\u4f46\u662fWSAWaitForMultipleEvents\u8fd8\u662f\u963b\u585e<br \/>\n\u5728\u90a3\u91cc\u5c31\u4e0d\u4f1a\u5904\u7406\u8fd9\u4e2a\u65b0\u8fde\u63a5\u7684Event\u4e86\u3002\u4e5f\u4e0d\u77e5\u9053\u8bf4\u660e\u767d\u4e86\u6ca1\u6709\u3002\u3002\u3002\u3002\u3002\u3002-_-b \u53ef\u80fd\u5728\u8fd9\u91cc\u4f60\u4e5f\u4f53\u4f1a\u4e0d\u5230\uff0c\u771f\u6b63\u7f16\u7801\u7684\u65f6\u5019\u5c31\u4f1a\u660e\u767d\u4e86\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u5176\u4ed6\u8fd8\u6709\u4e0d\u660e\u767d\u7684\u5730\u65b9\u53ef\u4ee5\u53c2\u8003\u6211\u7684\u4ee3\u7801\uff0c\u4ee3\u7801\u91cc\u4e5f\u6709\u6bd4\u8f83\u8be6\u5c3d\u7684\u6ce8\u91ca,\u3000 Enjoy~~~\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u4e0d\u8fc7\u53ef\u60dc\u662f\u4e3a\u4e86\u7167\u987e\u5927\u591a\u6570\u4eba\uff0c\u4f7f\u7528\u7684\u662fMFC\u7684\u4ee3\u7801\uff0c\u663e\u5f97\u4ee3\u7801\u6709\u4e9b\u6742\u4e71\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t<strong>\u516d\uff0e\u5df2\u77e5\u95ee\u9898<\/strong>\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000 \u3000\u8fd9\u4e2a\u5df2\u77e5\u95ee\u9898\u662f\u8bf4\u6211\u7684\u4ee3\u7801\u4e2d\u7684\u5df2\u77e5\u95ee\u9898\uff0c\u53ef\u4e0d\u662f\u91cd\u53e0\u7ed3\u6784\u7684\u5df2\u77e5\u95ee\u9898\uff1a\uff09\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u8fd9\u4e2a\u793a\u4f8b\u4ee3\u7801\u5df2\u7ecf\u5199\u597d\u4e86\u5f88\u4e45\u4e86\uff0c\u8fd9\u4e24\u5929\u505a\u6700\u540e\u6d4b\u8bd5\u7684\u65f6\u5019\u624d\u53d1\u73b0\u7adf\u7136\u6709\u4e24\u4e2aBug\uff0c\u800c\u4e14\u8fd8\u4e0d\u662f\u6bcf\u6b21\u90fd\u4f1a\u51fa\u73b0\uff0c5555\uff0c\u6211\u6700\u8fd1\u662f\u5b9e\u5728\u6ca1\u6709\u7cbe\u529b\u53bb\u6539\u4e86\uff0c\u5982<br \/>\n\u679c\u6709\u5fc3\u7684\u670b\u53cb\u80fd\u4fee\u6539\u6389\u8fd9\u4e24\u4e2aBug\uff0c\u90a3\u771f\u662f\u9020\u798f\u5927\u5bb6\u4e86\uff0c\u8fd9\u7bc7\u6587\u7ae0\u90fd\u9669\u4e9b\u6d41\u4ea7\uff0c\u6211\u66f4\u6ca1\u6709\u7ecf\u5386\u53bb\u4fee\u6539\u90fd\u5feb\u8981\u6de1\u5fd8\u4e86\u7684\u4ee3\u7801\u7684Bug\u4e86\uff0c\u6211\u5199\u5728\u8fd9\u91cc\u63d0\u9192\u4e00\u4e0b\u5927\u5bb6<br \/>\n\u4e86\uff0c\u53cd\u6b63\u8fd9\u4e2a\u4ee3\u7801\u4e5f\u4ec5\u4ec5\u662f\u629b\u7816\u5f15\u7389\u800c\u5df2\uff0c\u800c\u4e14\u6211\u89c9\u5f97\u6bd4\u8d77\u4ee3\u7801\u6765\u8fd8\u662f\u6587\u5b57\u6bd4\u8f83\u73cd\u8d35^_^\uff0c\u56e0\u4e3a\u91cd\u53e0\u6a21\u578b\u7684\u4ee3\u7801\u7f51\u4e0a\u4e5f\u8fd8\u662f\u6709\u4e0d\u5c11\u7684\u3002\u4e24\u4e2aBug\u662f\u8fd9\u6837\u7684\uff1a\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t1\uff0e\u3000 \u591a\u4e2a\u5ba2\u6237\u7aef\u5728\u8fde\u7eed\u9000\u51fa\u7684\u65f6\u5019\uff0c\u6709\u65f6\u4f1a\u51fa\u73b0\u5f02\u5e38\uff1b\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t2\uff0e\u3000 \u6709\u65f6\u591a\u4e2a\u5ba2\u6237\u7aef\u7684\u63a5\u6536\u7f13\u51b2\u533a\u7adf\u7136\u4f1a\u91cd\u53e0\u5230\u4e00\u8d77\uff0c\u5c31\u662f\u8bf4A\u5ba2\u6237\u7aef\u53d1\u9001\u7684\u6570\u636e\u540e\u9762\u4f1a\u6839\u6709B\u5ba2\u6237\u7aef\u4e0a\u6b21\u53d1\u6765\u7684\u6570\u636e\u3002\u3002\u3002\u3002\u3002-_-b\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u6539\u8fdb\u7b97\u6cd5\uff1a\u5176\u5b9e\u4ee3\u7801\u4e2d\u7684\u7b97\u6cd5\u8fd8\u6709\u5f88\u591a\u53ef\u4ee5\u6539\u8fdb\u7684\u5730\u65b9\uff0climin\u670b\u53cb\u5c31\u5411\u6211\u63d0\u53ca\u8fc7\u51e0\u4e2a\u975e\u5e38\u597d\u7684\u6539\u8fdb\u7b97\u6cd5\uff0c\u6bd4\u5982\u5982\u4f55\u5728socket\u6570\u7ec4\u4e2d\u5bfb\u627e\u7a7a\u95f2\u7684<br \/>\nsocket\u7528\u6765\u901a\u4fe1\uff0c\u4f46\u662f\u6211\u5e76\u6ca1\u6709\u52a0\u5230\u8fd9\u4efd\u4ee3\u7801\u91cc\u9762\u6765\uff0c\u56e0\u4e3a\u672c\u6765\u91cd\u53e0\u6a21\u578b\u7684\u4ee3\u7801\u5c31\u6bd4\u8f83\u6742\uff0c\u518d\u52a0\u4e0a\u8fd9\u4e9b\u4e1c\u897f\u6050\u6015\u53cd\u800c\u4f1a\u7ed9\u521d\u5b66\u8005\u5e26\u6765\u56f0\u96be\u3002\u4f46\u662f\u975e\u5e38\u6b22\u8fce\u5404\u4f4d<br \/>\n\u548c\u6211\u8ba8\u8bba\u91cd\u53e0\u6a21\u578b\u7684\u6539\u8fdb\u7b97\u6cd5\u4ee5\u53ca\u6211\u4ee3\u7801\u4e2d\u5b58\u5728\u95ee\u9898\uff01^_^<\/p>\n","protected":false},"excerpt":{"rendered":"<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\"><strong>\u4e00\uff0e\u91cd\u53e0\u6a21\u578b\u7684\u4f18\u70b9<\/strong><\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t1.\u53ef\u4ee5\u8fd0\u884c\u5728\u652f\u6301Winsock2\u7684\u6240\u6709Windows\u5e73\u53f0 ,\u800c\u4e0d\u50cf\u5b8c\u6210\u7aef\u53e3\u53ea\u662f\u652f\u6301NT\u7cfb\u7edf\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t2.\u6bd4\u8d77\u963b\u585e\u3001select\u3001WSAAsyncSelect\u4ee5\u53caWSAEventSelect\u7b49\u6a21\u578b\uff0c\u91cd\u53e0I\/O(Overlapped I\/O)\u6a21\u578b\u4f7f\u5e94\u7528\u7a0b\u5e8f\u80fd\u8fbe\u5230\u66f4\u4f73\u7684\u7cfb\u7edf\u6027\u80fd\u3002\n<\/p>\n<p style=\"margin-top:15px;margin-bottom:15px;padding-top:0px;padding-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;list-style-type:none;text-indent:0px;\">\n\t\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u56e0\u4e3a\u5b83\u548c\u8fd94\u79cd\u6a21\u578b\u4e0d\u540c\u7684\u662f\uff0c\u4f7f\u7528\u91cd\u53e0\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u901a\u77e5\u7f13\u51b2\u533a\u6536\u53d1\u7cfb\u7edf\u76f4\u63a5\u4f7f\u7528\u6570\u636e&#8230;<\/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-84","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>[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b - 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=84\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u4e00\uff0e\u91cd\u53e0\u6a21\u578b\u7684\u4f18\u70b9 1.\u53ef\u4ee5\u8fd0\u884c\u5728\u652f\u6301Winsock2\u7684\u6240\u6709Windows\u5e73\u53f0 ,\u800c\u4e0d\u50cf\u5b8c\u6210\u7aef\u53e3\u53ea\u662f\u652f\u6301NT\u7cfb\u7edf\u3002  2.\u6bd4\u8d77\u963b\u585e\u3001select\u3001WSAAsyncSelect\u4ee5\u53caWSAEventSelect\u7b49\u6a21\u578b\uff0c\u91cd\u53e0I\/O(Overlapped I\/O)\u6a21\u578b\u4f7f\u5e94\u7528\u7a0b\u5e8f\u80fd\u8fbe\u5230\u66f4\u4f73\u7684\u7cfb\u7edf\u6027\u80fd\u3002  \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u56e0\u4e3a\u5b83\u548c\u8fd94\u79cd\u6a21\u578b\u4e0d\u540c\u7684\u662f\uff0c\u4f7f\u7528\u91cd\u53e0\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u901a\u77e5\u7f13\u51b2\u533a\u6536\u53d1\u7cfb\u7edf\u76f4\u63a5\u4f7f\u7528\u6570\u636e...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=84\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-02-20T09:47:01+00:00\" \/>\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\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=84#webpage\",\"url\":\"http:\/\/weizn.net\/?p=84\",\"name\":\"[\\u8f6c]Windows\\u4e0b\\u91cd\\u53e0I\/O\\u6a21\\u578b - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"datePublished\":\"2014-02-20T09:47:01+00:00\",\"dateModified\":\"2014-02-20T09:47:01+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=84#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=84\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=84#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[\\u8f6c]Windows\\u4e0b\\u91cd\\u53e0I\/O\\u6a21\\u578b\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=84#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=84#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"[\\u8f6c]Windows\\u4e0b\\u91cd\\u53e0I\/O\\u6a21\\u578b\",\"datePublished\":\"2014-02-20T09:47:01+00:00\",\"dateModified\":\"2014-02-20T09:47:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=84#webpage\"},\"wordCount\":568,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"articleSection\":[\"C\/C++\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=84#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":"[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b - 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=84","og_locale":"zh_CN","og_type":"article","og_title":"[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b - Wayne&#039;s Blog","og_description":"\u4e00\uff0e\u91cd\u53e0\u6a21\u578b\u7684\u4f18\u70b9 1.\u53ef\u4ee5\u8fd0\u884c\u5728\u652f\u6301Winsock2\u7684\u6240\u6709Windows\u5e73\u53f0 ,\u800c\u4e0d\u50cf\u5b8c\u6210\u7aef\u53e3\u53ea\u662f\u652f\u6301NT\u7cfb\u7edf\u3002  2.\u6bd4\u8d77\u963b\u585e\u3001select\u3001WSAAsyncSelect\u4ee5\u53caWSAEventSelect\u7b49\u6a21\u578b\uff0c\u91cd\u53e0I\/O(Overlapped I\/O)\u6a21\u578b\u4f7f\u5e94\u7528\u7a0b\u5e8f\u80fd\u8fbe\u5230\u66f4\u4f73\u7684\u7cfb\u7edf\u6027\u80fd\u3002  \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u56e0\u4e3a\u5b83\u548c\u8fd94\u79cd\u6a21\u578b\u4e0d\u540c\u7684\u662f\uff0c\u4f7f\u7528\u91cd\u53e0\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u901a\u77e5\u7f13\u51b2\u533a\u6536\u53d1\u7cfb\u7edf\u76f4\u63a5\u4f7f\u7528\u6570\u636e...","og_url":"http:\/\/weizn.net\/?p=84","og_site_name":"Wayne&#039;s Blog","article_published_time":"2014-02-20T09:47:01+00:00","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":"WebPage","@id":"http:\/\/weizn.net\/?p=84#webpage","url":"http:\/\/weizn.net\/?p=84","name":"[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"datePublished":"2014-02-20T09:47:01+00:00","dateModified":"2014-02-20T09:47:01+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=84#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=84"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=84#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=84#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=84#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"[\u8f6c]Windows\u4e0b\u91cd\u53e0I\/O\u6a21\u578b","datePublished":"2014-02-20T09:47:01+00:00","dateModified":"2014-02-20T09:47:01+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=84#webpage"},"wordCount":568,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"articleSection":["C\/C++"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=84#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\/84","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=84"}],"version-history":[{"count":0,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/84\/revisions"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}