{"id":204,"date":"2014-08-25T22:11:57","date_gmt":"2014-08-25T14:11:57","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=204"},"modified":"2014-08-25T22:11:58","modified_gmt":"2014-08-25T14:11:58","slug":"diocp3-%e5%85%b3%e4%ba%8e%e6%8e%a5%e6%94%b6%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=204","title":{"rendered":"DIOCP3 &#8211; \u5173\u4e8e\u63a5\u6536\u6570\u636e"},"content":{"rendered":"<p>DIOCP3\u652f\u6301\u4e24\u79cd\u65b9\u5f0f\u63a5\u6536\u6570\u636e\uff0c<\/p>\n<p>&nbsp;<\/p>\n<p>\u7b2c\u4e00\u79cd\u662f\u539f\u59cb\u7684\u6d41\u6570\u636e, \u6700\u901a\u7528\u7684\u4e00\u79cd\u65b9\u5f0f\uff0c\u5ba2\u6237\u7aef\u53d1\u5565\uff0c\u8fd9\u8fb9\u5c31\u6536\u5230\u5565\u3002\u9700\u8981\u81ea\u5df1\u5904\u7406\u7c98\u5305\u95ee\u9898\u3002<\/p>\n<p>\u53ef\u4ee5\u5728TCilentContext\u6216\u8005TIocpTcpServer\u7684OnRecvBuffer\u4e2d\u5904\u7406\uff0c \u5982\u679cErrcode = 0\u53ef\u4ee5\u8fdb\u884c\u6536\u5230\u6570\u636e\u7684\u5904\u7406<\/p>\n<p>\u4e0b\u9762\u8fd9\u4e24\u4e2a\u90fd\u4f1a\u89e6\u53d1<\/p>\n<p>TIocpClientContext<\/p>\n<p>procedure OnRecvBuffer(buf: Pointer; len: Cardinal; ErrCode: WORD); override;<\/p>\n<p>&nbsp;<\/p>\n<p>TIocpTcpServer<\/p>\n<p>property OnDataReceived: TOnDataReceived read FOnDataReceived write<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOnDataReceived;<\/p>\n<p>&nbsp;<\/p>\n<p>\u7b2c\u4e8c\u79cd\u662f\u7f16\u7801\u5668\u548c\u89e3\u7801\u5668\u7684\u65b9\u5f0f\u3002\u8be5\u65b9\u5f0f\u8fdb\u884c\u4e86\u4e00\u6b21\u5c01\u88c5\uff0c<font color=\"#ff0000\">\u5728OnRecvBuffer\u4e2d\u540e\uff0c\u4f1a\u5bf9\u6570\u636e\u8fdb\u884c\u7f13\u5b58\u5b58\u653e\uff0c\u7136\u540e\u8c03\u7528\u89e3\u7801\u5668\u8fdb\u884c\u89e3\u7801\u6570\u636e\uff0c \u5982\u679c\u89e3\u7801\u6210\u529f\u4f1a\u7528IocpTask\/\u6216\u8005QWokers\u628a\u6570\u636e\u5bf9\u8c61\u6295\u9012\u5230\u903b\u8f91\u7ebf\u7a0b\u8fdb\u884c\u5904\u7406&lt;\u5e38\u8bf4\u7684\u901a\u4fe1\u7ebf\u7a0b\u548c\u5de5\u4f5c\u7ebf\u7a0b\u5206\u79bb\u7684\u6a21\u5f0f&gt;\u3002<\/font><\/p>\n<p>&nbsp;<\/p>\n<p>TIOCPCoderClientContext<\/p>\n<p>procedure dataReceived(const pvDataObject:TObject); override;<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u8fd9\u4e2a\u51fd\u6570\u4e0b\u9762\u53ef\u4ee5\u4e0d\u7528\u53bb\u7ba1\u7c98\u5305\u95ee\u9898\u3002\u63a5\u53d7\u5230\u7684\u662f\u4f60\u5ba2\u6237\u7aef\u53d1\u9001\u8fc7\u6765\u7684\u5bf9\u8c61\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DIOCP3\u652f\u6301\u4e24\u79cd\u65b9\u5f0f\u63a5\u6536\u6570\u636e\uff0c &#038;n [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[43],"tags":[],"class_list":["post-204","post","type-post","status-publish","format-standard","hentry","category-diocp3"],"views":4400,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=204"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/204\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/204\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}