{"id":148,"date":"2014-08-24T18:30:03","date_gmt":"2014-08-24T10:30:03","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=148"},"modified":"2014-08-24T18:30:03","modified_gmt":"2014-08-24T10:30:03","slug":"diocp%e5%bc%80%e6%ba%90%e9%a1%b9%e7%9b%ae-%e9%ab%98%e6%95%88%e7%a8%b3%e5%ae%9a%e7%9a%84%e6%9c%8d%e5%8a%a1%e7%ab%af%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88diocp-%e6%97%a0%e9%94%81%e9%98%9f%e5%88%97-ze","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=148","title":{"rendered":"DIOCP\u5f00\u6e90\u9879\u76ee-\u9ad8\u6548\u7a33\u5b9a\u7684\u670d\u52a1\u7aef\u89e3\u51b3\u65b9\u6848(DIOCP + \u65e0\u9501\u961f\u5217 + ZeroMQ + QWorkers) \u51fa\u7089\u4e86"},"content":{"rendered":"<h2 style=\"color: #494949\"><span style=\"color: #0000ff\">[\u6982\u8ff0]<\/span><\/h2>\n<p style=\"color: #494949\">\u81ea\u4ece\u4e0a\u6b21\u53d1\u5e03\u4e86[<a style=\"color: #494949\" href=\"http:\/\/www.cnblogs.com\/DKSoft\/p\/3750758.html\">DIOCP\u5f00\u6e90\u9879\u76ee-\u5229\u7528\u961f\u5217+0MQ+\u591a\u8fdb\u7a0b\u903b\u8f91\u5904\u7406\uff0c\u642d\u5efa\u7a33\u5b9a,\u9ad8\u6548,\u5206\u5e03\u5f0f\u7684\u670d\u52a1\u7aef<\/a>]\u6587\u7ae0\u540e\uff0c\u5f97\u5230\u4e86\u5f88\u591a\u670b\u53cb\u7684\u652f\u6301\u548c\u80af\u5b9a\u3002\u8fd9\u52a0\u5927\u4e86\u6211\u7684\u5f00\u53d1\u52a8\u529b\uff0c\u7ecf\u8fc7\u51e0\u4e2a\u665a\u4e0a\u7684\u71ac\u591c\uff0c\u7ec8\u4e8e\u5728\u6628\u5929\u665a\u4e0a\uff0cDEMO\u57fa\u672c\u6210\u578b\uff0c\u4eca\u5929\u518d\u52a0\u5165\u4e86QWorkers\u6765\u505a\u903b\u8f91\u5904\u7406\u8fdb\u7a0b\uff0c\u8fdb\u4e00\u6b65\u4f7f\u5f97\u903b\u8f91\u5904\u7406\u8fdb\u7a0b\u66f4\u52a0\u65b9\u4fbf\u548c\u9ad8\u6548\u3002\u4eca\u5929\u7279\u610f\u5199\u7bc7blog\u6765\u8bb0\u5f55\u6211\u7684\u5fc3\u5f97\u4e0e\u5927\u5bb6\u5206\u4eab\u3002<\/p>\n<p style=\"color: #494949\">\n<h2 style=\"color: #494949\"><span style=\"color: #0000ff\">[\u529f\u80fd\u5b9e\u73b0\u8bf4\u660e]<\/span><\/h2>\n<p style=\"color: #494949\">\u6cbf\u7528\u4e0a\u6b21\u7684\u8349\u56fe<\/p>\n<p style=\"color: #494949\"><img decoding=\"async\" src=\"http:\/\/images.cnitblog.com\/i\/1998\/201405\/250908533719700.jpg\" alt=\"\" \/><\/p>\n<p style=\"color: #494949\">\u76ee\u524dDEMO\u56fe\u4e0a\u7684\u529f\u80fd\u90fd\u5df2\u7ecf\u5b9e\u73b0\u3002\u4e0b\u9762\u8c08\u8c08\u5404\u90e8\u5206\u7684\u5b9e\u73b0\u3002<\/p>\n<p style=\"color: #494949\">\n<ul style=\"color: #494949\">\n<li>\u901a\u4fe1\u670d\u52a1, \u7531DIOCP\u5b9e\u73b0,\u62c5\u5f53\u4e0e\u5ba2\u6237\u7aef\u7684\u901a\u4fe1\u5de5\u4f5c\uff0c\u8d1f\u8d23\u63a5\u6536\u6570\u636e\u5305\uff0c\u5904\u7406\u7c98\u5305\u548c\u6570\u636e\u56de\u4f20\u7684\u5de5\u4f5c<\/li>\n<li>\u6570\u636e\u5206\u53d1\u961f\u5217, \u7531uWorkDispatcher\u5355\u5143\u5b9e\u73b0, \u5176\u4e2d\u5229\u7528 OTL\u4e2d\u7684\u65e0\u9501\u961f\u5217\u62c5\u5f53\u6570\u636e\u7684\u7f13\u5b58\uff0c\u5728\u4f7f\u7528uJobPusher\u63a8\u9001\u961f\u5217\u4e2d\u7684\u4efb\u52a1\u3002<\/li>\n<li>\u6570\u636e\u63a8\u9001\uff0c\u7531ZeroMQ\u5b8c\u6210\uff0c\u4f7f\u7528Push\/Pull\u6a21\u5f0f\uff0c\u7531\u4e8e\u7b2c\u4e00\u6b21\u63a5\u89e6ZeroMQ\uff0c\u53ef\u80fd\u6ca1\u6709\u6316\u6398\u5230ZeroMQ\u7684\u6f5c\u529b\uff0c\u5bfc\u81f4\u73b0\u5728\u8fdb\u7a0b\u4e4b\u95f4\u4f20\u9012\u90fd\u662f\u7ebf\u7a0b\u64cd\u4f5c\uff0c\u5f00\u59cb\u4e00\u76f4\u62c5\u5fc3\u8fd9\u4e2a\u95ee\u9898\uff0c\u8fdf\u8fdf\u6ca1\u6709\u4e0b\u624b\uff0c\u6700\u540e\u8fd8\u662f\u575a\u6301\u7528\u4e86\uff0c\u6548\u679c\u8fd8\u4e0d\u9519\u3002<\/li>\n<li>\u903b\u8f91\u5904\u7406\u8fdb\u7a0b\uff0c\u7531\u4e3b\u63a7\u53f0\u7a0b\u5e8f\u5b8c\u6210\uff0c\u91cc\u9762\u4e3b\u8981\u6536\u5230\u6570\u636e\u5206\u53d1\u961f\u5217\u4e2d\u5206\u53d1\u8fc7\u6765\u7684\u4efb\u52a1\u540e\uff0c\u8fdb\u884c\u903b\u8f91\u5904\u7406\uff0c\u7136\u540e\u518d\u5c06\u9700\u8981\u8fd4\u56de\u7684\u6570\u636e\uff0c\u63a8\u9001\u56de\u901a\u4fe1\u670d\u52a1\u8fdb\u7a0b(\u7531uJobReceiver\u5355\u5143\u5904\u7406)\uff0c\u5e76\u6295\u9012\u5230DIOCP\u4f20\u8f93\u961f\u5217\uff0c\u8be5\u8fdb\u7a0b\u4e2d\u4f7f\u7528\u5230QWorkers\u3002\u7b49\u4e00\u4e0b\u6211\u4e13\u95e8\u4ecb\u7ecd\u8fd9\u4e2a\u65b9\u4fbf\u7684\u961f\u5217\u4efb\u52a1\u5904\u7406\u7c7b\u3002<\/li>\n<li>\u5ba2\u6237\u7aef,\u7531TCPClient\u5b9e\u73b0\u6570\u636e\u7684\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<p style=\"color: #494949\">\n<h2 style=\"color: #494949\"><span style=\"color: #0000ff\">[QWorkers\u8bf4\u660e]<\/span><\/h2>\n<p style=\"color: #494949\">\u4e4b\u524d\u4e00\u76f4\u60f3\u8bbe\u8ba1\u4e00\u4e2a\u8fd9\u6837\u7684\u4e1c\u897f\uff0c\u51e0\u6b21\u4e0b\u6765\u90fd\u4e0d\u5982\u610f\uff0c\u81ea\u4ece\u63a5\u89e6\u5230QWorkers\u540e\uff0c\u53d1\u73b0\u539f\u6765\u5e94\u8be5\u8fd9\u6837\u53bb\u8bbe\u8ba1\u3002\u4e0b\u9762\u662f\u6211\u7814\u7a76QWorkers\u753b\u7684\u4e00\u6d41\u7a0b\u56fe\u3002\u4e00\u4e2a\u4e2d\u5348\u7684\u5403\u996d\u7684\u65f6\u95f4\uff0c\u57fa\u672c\u4e0a\u5c31\u53ef\u4ee5\u7406\u89e380%\uff0c\u4f5c\u8005\u8bbe\u8ba1\u601d\u8def\u660e\u786e\uff0c\u4f7f\u7528\u7b80\u5355\uff0c\u800c\u4e14\u961f\u5217\u4f7f\u7528\u539f\u5b50\u9501\uff0c\u4e5f\u6bd4\u4f7f\u7528\u4e34\u754c\u9ad8\u6548\u4e0d\u5c11\u3002\u4f5c\u8005\u662fQDAC\u5f00\u6e90\u9879\u76ee\u7684\u53d1\u8d77\u4eba\u3002<\/p>\n<p style=\"color: #494949\"><a style=\"color: #494949\" href=\"http:\/\/images.cnitblog.com\/blog\/1998\/201405\/282323465729207.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" src=\"http:\/\/images.cnitblog.com\/blog\/1998\/201405\/282323486039619.png\" alt=\"image\" width=\"547\" height=\"228\" border=\"0\" \/><\/a><\/p>\n<p style=\"color: #494949\">\u4e3b\u8981\u4f5c\u7528\uff0c\u4efb\u52a1(\u53ef\u4ee5\u5355\u6b21\u4efb\u52a1\uff0c\u5b9a\u65f6\u4efb\u52a1(\u6bd4\u5982\u6bcf\u592912:00\u6267\u884c), \u5ef6\u65f6\u4efb\u52a1, \u624b\u52a8\u89e6\u53d1\u4efb\u52a1)\u7684\u6295\u9012\u548c\u6267\u884c\u3002\u9002\u5408\u505a\u903b\u8f91\u8fd0\u7b97\u4efb\u52a1\u3002\u5177\u4f53\u4f7f\u7528\u53ef\u4ee5\u53c2\u8003DEMO[DIOCP\\Demos\\MultiProcessor\\processorWithQWorker]<\/p>\n<p style=\"color: #494949\">\n<h2 style=\"color: #494949\"><span style=\"color: #0000ff\">[ZeroMQ]<\/span><\/h2>\n<p style=\"color: #494949\">ZeroMQ\u662f\u4e00\u79cd\u57fa\u4e8e\u6d88\u606f\u961f\u5217\u7684\u591a\u7ebf\u7a0b\u7f51\u7edc\u5e93\uff0c\u5176\u5bf9\u5957\u63a5\u5b57\u7c7b\u578b\u3001\u8fde\u63a5\u5904\u7406\u3001\u5e27\u3001\u751a\u81f3\u8def\u7531\u7684\u5e95\u5c42\u7ec6\u8282\u8fdb\u884c\u62bd\u8c61\uff0c\u63d0\u4f9b\u8de8\u8d8a\u591a\u79cd\u4f20\u8f93\u534f\u8bae\u7684\u5957\u63a5\u5b57\u3002ZeroMQ\u662f\u7f51\u7edc\u901a\u4fe1\u4e2d\u65b0\u7684\u4e00\u5c42\uff0c\u4ecb\u4e8e\u5e94\u7528\u5c42\u548c\u4f20\u8f93\u5c42\u4e4b\u95f4\uff08\u6309\u7167TCP\/IP\u5212\u5206\uff09\uff0c\u5176\u662f\u4e00\u4e2a\u53ef\u4f38\u7f29\u5c42\uff0c\u53ef\u5e76\u884c\u8fd0\u884c\uff0c\u5206\u6563\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u95f4\u3002<\/p>\n<p style=\"color: #494949\">\u63a8\u8350\u5927\u5bb6\u770b\u4e24\u904dblog, \u6211\u5c31\u4e0d\u591a\u5199\u4e86\u3002<\/p>\n<p style=\"color: #494949\"><a style=\"color: #494949\" href=\"http:\/\/www.cnblogs.com\/rainbowzc\/p\/3357594.html\">ZeroMQ\u7814\u7a76\u4e0e\u5e94\u7528\u5206\u6790<\/a>:\u00a0\u00a0<a style=\"color: #494949\" href=\"http:\/\/www.cnblogs.com\/rainbowzc\/p\/3357594.html\">ttp:\/\/www.cnblogs.com\/rainbowzc\/p\/3357594.html<\/a><\/p>\n<p style=\"color: #494949\">Delphi\u5b9e\u6218:\u00a0<a style=\"color: #494949\" href=\"http:\/\/my.oschina.net\/zeroflamy\/blog\/109457\">http:\/\/my.oschina.net\/zeroflamy\/blog\/109457<\/a><\/p>\n<p style=\"color: #494949\">\n<h2 style=\"color: #494949\"><span style=\"color: #0000ff\">[\u5173\u4e8eDEMO]<\/span><\/h2>\n<p style=\"color: #494949\">\u7a0b\u5e8f\u4f7f\u7528XE5\u7f16\u8bd1,<\/p>\n<p style=\"color: #494949\">\u670d\u52a1\u7aef(SERVER):DIOCP\u662f\u652f\u6301D7-XE6\u7684\uff0c\u6240\u4ee5Server\u53ef\u4ee5\u7528D7-XE6\u539f\u7406\u4e0a\u662f\u53ef\u4ee5\u7f16\u8bd1\u7684\uff0c\u53ea\u662f\u5de5\u7a0b\u6587\u4ef6\u662fXE5\u7f16\u8bd1\u7684\uff0c\u9700\u8981\u81ea\u5df1\u7a0d\u4f5c\u5904\u7406<\/p>\n<p style=\"color: #494949\">\u5ba2\u6237\u7aef(TCPClient): D7-XE6\u90fd\u5e94\u8be5\u6ca1\u6709\u95ee\u9898\u3002\u4f7f\u7528\u7684\u6807\u5fd7\u63a7\u4ef6(TcpClient)\uff0c\u6807\u51c6\u5199\u6cd5.<\/p>\n<p style=\"color: #494949\">\u903b\u8f91\u5904\u7406\u8fdb\u7a0b(processor):\u8d85\u7ea7\u7b80\u5355\u7684\u5904\u7406\u8fdb\u7a0b\u3002D7-XE6<\/p>\n<p style=\"color: #494949\">\u903b\u8f91\u5904\u7406\u8fdb\u7a0b(processorWithQWorker):\u7531\u4e8e\u4f7f\u7528\u4e86QWorkers\uff0c\u53ea\u80fd\u652f\u6301D2007\u4ee5\u4e0a\u7684\u7248\u672c.<\/p>\n<p style=\"color: #494949\">\n<h2 style=\"color: #494949\"><span style=\"color: #0000ff\">[\u5173\u4e8e\u89e3\u51b3\u65b9\u6848\u7684\u5e94\u7528]<\/span><\/h2>\n<p style=\"color: #494949\">\u8be5\u6846\u67b6\u4e3b\u8981\u7528\u4e8eERP\u7684\u4e09\u5c42\u6846\u67b6\u3002\u903b\u8f91\u5904\u7406\u8fdb\u7a0b\u53ef\u4ee5\u5b9e\u73b0\u70ed\u62d4\u63d2\u3002\u53ef\u4ee5\u542f\u52a8\u591a\u4e2a\u3002\u81ea\u52a8\u63a5\u6536\u4efb\u52a1\u3002\u5e95\u5c42\u7a33\u5b9a\uff0c\u6301\u7eed\u51e0\u4e2a\u6708\u7684\u670d\u52a1\u7aef\u518d\u4e5f\u4e0d\u662f\u4ec0\u4e48\u96be\u4e8b\u4e86\u2026.<\/p>\n<p style=\"color: #494949\">\u540e\u7eed\u4f1a\u7ed3\u5408MyBean\u6846\u67b6\u505a\u4e00\u4e9b\u4f8b\u5b50\u7684\u6574\u5408\u3002<\/p>\n<p style=\"color: #494949\">\n<p style=\"color: #494949\">\u6b22\u8fce\u5927\u5bb6\u7ee7\u7eed\u5173\u6ce8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[\u6982\u8ff0] \u81ea\u4ece\u4e0a\u6b21\u53d1\u5e03\u4e86[DIOCP\u5f00\u6e90 [&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":[1],"tags":[],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"views":7148,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/148","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=148"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":149,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions\/149"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}