{"id":321,"date":"2014-08-28T11:00:28","date_gmt":"2014-08-28T03:00:28","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=321"},"modified":"2014-08-28T11:03:13","modified_gmt":"2014-08-28T03:03:13","slug":"qsocket%e6%9e%84%e6%83%b3-qsocket%e7%9a%84%e5%b1%82%e6%ac%a1%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=321","title":{"rendered":"QSocket\u6784\u60f3-QSocket\u7684\u5c42\u6b21\u6a21\u578b"},"content":{"rendered":"<p>QSocket\u662fQDB\u5b8c\u6210\u540e\u7684\u4e0b\u4e00\u4e2a\u5927\u5751\uff0c\u5e95\u5c42\u4f1a\u57fa\u4e8eIOCP\uff08Windows\u7cfb\uff09\u3001EPoll\uff08Linux\u7cfb\uff09\u548cKQueue\uff08OSX\uff0cFreeBSD\u7cfb\uff09\uff0c\u4ee5Delphi\u5b9e\u73b0\u7684\u8de8\u5e73\u53f0\u7684\u7f51\u7edc\u4e1a\u52a1\u652f\u6301\u5e73\u53f0\u3002<\/p>\n<p>\u8bbe\u60f3\u4e2d\u7684QSocket\u5206\u4e3a\u51e0\u4e2a\u5c42\u6b21\uff1a<\/p>\n<p>1\u3001\u4f20\u8f93\u5c42<\/p>\n<p>\u4f20\u8f93\u5c42\u8d1f\u8d23\u6570\u636e\u51c6\u786e\u9001\u8fbe\uff0c\u5728\u4f20\u8f93\u5c42\u4ea7\u751f\u8fde\u63a5\u7684\u6982\u5ff5\uff0c\u4f1a\u4e3a\u6bcf\u4e2a\u8fde\u63a5\u751f\u6210\u4e00\u4e2a\u552f\u4e00\u7684ID\u3002\u4f20\u8f93\u5c42\u8981\u652f\u6301\u7ec4\u64ad\u548c\u5e7f\u64ad\uff0c\u5982\u679c\u5e95\u5c42\u4e0d\u652f\u6301\uff08\u5982TCP\u534f\u8bae\u4e0d\u652f\u6301\u5e7f\u64ad\uff09\uff0c\u5219\u91c7\u7528\u6a21\u62df\u65b9\u5f0f\u5b9e\u73b0\u3002<\/p>\n<p>\u8fd9\u4e00\u5c42\u5b9e\u9645\u4e0a\u53ef\u4ee5\u8ba4\u4e3a\u53ea\u662f\u64cd\u4f5c\u7cfb\u7edf\u5e95\u5c42Socket\u7684\u7b80\u5355\u5c01\u88c5\uff0c\u662f\u6240\u6709\u540e\u9762\u7684\u57fa\u7840\uff0c\u800c\u4e14\u540e\u9762\u7684\u4e1c\u897f\u4f60\u53ef\u4ee5\u653e\u5f03\u4e0d\u7528\uff0c\u63d0\u4f9b\u81ea\u5df1\u7684\u89e3\u51b3\u65b9\u6848\u3002\u540e\u9762\u7684\u51e0\u5c42\u63d0\u4f9b\u4e86\u9ed8\u8ba4\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p>2\u3001\u4f1a\u8bdd\u7ba1\u7406\u5c42<\/p>\n<p>\u5728QSocket\u4e2d\uff0c\u4e00\u4e2a\u8bf7\u6c42\u548c\u56de\u5e94\u5c31\u6784\u6210\u4e00\u4e2a\u4f1a\u8bdd\u3002\u4f1a\u8bdd\u4e4b\u95f4\u53ef\u4ee5\u76f8\u4e92\u72ec\u7acb\uff0c\u4e5f\u53ef\u4ee5\u6709\u5148\u540e\u4f9d\u8d56\u5173\u7cfb\u3002\u6bcf\u4e2a\u4f1a\u8bdd\u62e5\u6709\u72ec\u7acb\u7684\u4f1a\u8bdd\u7f16\u7801\uff0c\u76f8\u4e92\u72ec\u7acb\u7684\u4f1a\u8bdd\uff0c\u5728\u4f20\u8f93\u5c42\u901a\u8fc7\u6253\u5305\u5e76\u884c\u53d1\u9001\u5230\u670d\u52a1\u5668\u7aef\uff0c\u800c\u4e32\u884c\u7684\u4f1a\u8bdd\u4f1a\u4e25\u683c\u6309\u7167\u6295\u5bc4\u7684\u5148\u540e\u987a\u5e8f\uff0c\u53d1\u9001\u5230\u670d\u52a1\u5668\u7aef\uff0c\u7b49\u5f85\u56de\u5e94\uff0c\u518d\u53d1\u9001\u4e0b\u4e00\u4e2a\uff0c\u5f62\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u4f1a\u8bdd\u94fe\u6761\u3002\u5e76\u884c\u7684\u72ec\u7acb\u4f1a\u8bdd\u53ef\u4ee5\u907f\u514d\u957f\u4f1a\u8bdd\u963b\u585e\u77ed\u4f1a\u8bdd\u7684\u95ee\u9898\u4ea7\u751f\u3002<\/p>\n<p>\u4f1a\u8bdd\u5c42\u5b9e\u9645\u7ba1\u7406\u4f1a\u8bdd\u7684\u6295\u5bc4\u548c\u6d3e\u53d1\uff0c\u6570\u636e\u7684\u5c01\u5305\u683c\u5f0f\u7531\u4e0d\u540c\u7684\u7f16\u7801\u5668\u548c\u89e3\u7801\u5668\u8d1f\u8d23\u3002\u6211\u4eec\u7b80\u5355\u63cf\u8ff0\u4e00\u4e0b\u666e\u901a\u4f1a\u8bdd\u7684\u5de5\u4f5c\u8fc7\u7a0b\uff1a<\/p>\n<p>\u3010\u53d1\u9001\u7aef\u3011<\/p>\n<p>\uff081\uff09\u3001\u7528\u6237\u6295\u5bc4\u4e86\u4f1a\u8bdd\u5230\u4f1a\u8bdd\u7ba1\u7406\u5c42\u3002<\/p>\n<p>\uff082\uff09\u3001\u4f1a\u8bdd\u7ba1\u7406\u5c42\u8c03\u7528\u7f16\u7801\u5668\u8fdb\u884c\u7f16\u7801\uff0c\u7136\u540e\u4f1a\u5c06\u7f16\u7801\u597d\u7684\u4f1a\u8bdd\u5c01\u5305\u5165\u5230\u6295\u5bc4\u961f\u5217\u4e2d\u3002<\/p>\n<p>\uff083\uff09\u3001\u6295\u5bc4\u961f\u5217\u4ece\u4f1a\u8bdd\u5217\u8868\u4e2d\u6309\u7167\u4f18\u5148\u7ea7\uff0c\u53d6\u6570\u636e\u8fdb\u884c\u6253\u5305\u5c01\u88c5\u3002\u6b64\u65f6\uff0c\u4f1a\u68c0\u67e5\u662f\u5426\u6709\u538b\u7f29\u7f16\u7801\u5668\u7684\u5b58\u5728\uff0c\u6709\u5219\u5bf9\u53d6\u51fa\u7684\u6570\u636e\u8fdb\u884c\u538b\u7f29\uff0c\u5e76\u8fdb\u4e00\u6b65\u68c0\u67e5\u662f\u5426\u6709\u989d\u5916\u7684\u5269\u4f59\u7a7a\u95f4\uff0c\u5faa\u73af\u6253\u5305\u81f3\u5c01\u5305\u5927\u5c0f\u4e0a\u9650\u6216\u8005\u6ca1\u6709\u53ef\u4f9b\u53d1\u9001\u7684\u6570\u636e\u6ca1\u6b62\u3002\u591a\u4e2a\u4f1a\u8bdd\u4f1a\u5408\u5e76\u5230\u4e00\u4e2a\u5927\u7684\u586b\u5305\u4e2d\u4e00\u8d77\u53d1\u9001\u3002<\/p>\n<p>\uff084\uff09\u3001\u6295\u5bc4\u961f\u5217\u68c0\u67e5\u662f\u5426\u6709\u52a0\u5bc6\u7f16\u7801\u5668\uff0c\u6709\u5219\u5c06\u52a0\u5bc6\u4e0a\u4e00\u6b65\u4ea7\u751f\u7684\u5c01\u5305\u3002\u7136\u540e\u4f20\u9001\u7ed9\u4f20\u8f93\u5c42\uff0c\u4f20\u8f93\u5c42\u5c06\u6570\u636e\u5305\u53d1\u9001\u5230\u76ee\u6807\u3002<\/p>\n<p>\u3010\u63a5\u6536\u7aef\u3011<\/p>\n<p>\uff085\uff09\u3001\u4f20\u8f93\u5c42\u5c06\u6536\u5230\u7684\u6570\u636e\u5305\u6d3e\u53d1\u7ed9\u4f1a\u8bdd\u7ba1\u7406\u5c42\u3002<\/p>\n<p>\uff086\uff09\u3001\u4f1a\u8bdd\u7ba1\u7406\u5c42\u7684\u63a5\u6536\u961f\u5217\u68c0\u67e5\u662f\u5426\u52a0\u5bc6\uff0c\u5982\u679c\u52a0\u5bc6\uff0c\u4f1a\u68c0\u67e5\u662f\u5426\u6709\u52a0\u5bc6\u89e3\u7801\u5668\uff0c\u6709\u5219\u89e3\u5bc6\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u8fd4\u56de\u53d1\u9001\u7aef\u9519\u8bef\u4ee3\u7801\uff08\u4e0d\u652f\u6301\u7684\u52a0\u5bc6\u65b9\u5f0f\uff09\u3002<\/p>\n<p>\uff087\uff09\u3001\u63a5\u6536\u961f\u5217\u68c0\u67e5\u6570\u636e\u662f\u5426\u88ab\u538b\u7f29\uff0c\u5982\u679c\u538b\u7f29\uff0c\u4eba\u68c0\u67e5\u662f\u5426\u6709\u89e3\u538b\u89e3\u7801\u5668\uff0c\u6709\u5219\u89e3\u538b\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u8fd4\u56de\u53d1\u9001\u7aef\u9519\u8bef\u4ee3\u7801\uff08\u4e0d\u652f\u6301\u7684\u538b\u7f29\u65b9\u5f0f\uff09\u3002<\/p>\n<p>\uff088\uff09\u3001\u63a5\u6536\u961f\u5217\u5206\u89e3\u6536\u5230\u7684\u6570\u636e\u5305\u4f1a\u8bdd\u6570\u636e\u5230\u76f8\u5e94\u7684\u4f1a\u8bdd\uff0c\u5e76\u68c0\u67e5\u4f1a\u8bdd\u662f\u5426\u63a5\u6536\u5b8c\u6210\uff0c\u63a5\u6536\u5b8c\u6210\uff0c\u5219\u89e6\u53d1\u6d3e\u53d1\u64cd\u4f5c\uff0c\u4ea4\u7531\u4e1a\u52a1\u5c42\u5904\u7406\u5177\u4f53\u7684\u8bf7\u6c42\u3002\u5982\u679c\u672a\u5b8c\u6210\uff0c\u5219\u7b49\u5f85\u540e\u7eed\u7684\u6570\u636e\u5305\u3002<\/p>\n<p>3\u3001\u4e1a\u52a1\u5e94\u7528\u5c42<\/p>\n<p>\u4e1a\u52a1\u5e94\u7528\u5c42\u4e3b\u8981\u662f\u548c\u4f1a\u8bdd\u7ba1\u7406\u5c42\u8fdb\u884c\u4ea4\u4e92\uff0c\u5b8c\u6210\u4e1a\u52a1\u903b\u8f91\u7684\u5b9e\u73b0\u3002\u8fd9\u5c42\u662f\u5b8c\u5168\u4ea4\u7531\u7528\u6237\u5b9e\u73b0\u7684\u3002\u4f46QSocket\u4f1a\u5b9e\u73b0\u4e00\u4e2a\u7f51\u7edc\u4fe1\u53f7\u4f20\u9001\u673a\u5236\uff0c\u4ee5\u4fbf\u7b80\u5316\u4e1a\u52a1\u5c42\u7684\u5f00\u53d1\u5de5\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>QSocket\u662fQDB\u5b8c\u6210\u540e\u7684\u4e0b\u4e00\u4e2a\u5927\u5751 [&hellip;]<\/p>\n","protected":false},"author":1,"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":[8,51],"tags":[],"class_list":["post-321","post","type-post","status-publish","format-standard","hentry","category-delphi","category-qsocket"],"views":5384,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/321","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=321"}],"version-history":[{"count":2,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions\/323"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}