{"id":1029,"date":"2025-12-07T20:30:23","date_gmt":"2025-12-07T12:30:23","guid":{"rendered":"http:\/\/www.tgwttt.xyz\/?p=1029"},"modified":"2025-12-07T22:18:14","modified_gmt":"2025-12-07T14:18:14","slug":"__trashed-3","status":"publish","type":"post","link":"https:\/\/www.tgwttt.xyz\/?p=1029","title":{"rendered":"\u57fa\u4e8e\u591aReactor\u7684epoll\u9ad8\u5e76\u53d1\u4ee3\u7406\u670d\u52a1\u5668"},"content":{"rendered":"\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>\u4ee3\u7801\u5730\u5740\uff1a<a href=\"https:\/\/gitee.com\/tgwTTT\/super-238\/tree\/server\/Tcpepollserver\">https:\/\/gitee.com\/tgwTTT\/super-238\/tree\/server\/Tcpepollserver<\/a><\/p>\n\n\n\n<p>\u5efa\u8bae\u9605\u8bfb\u672c\u6587\u65f6\u5148\u9605\u8bfb\u535a\u4e3b\u4ee5\u524d\u7684\u6587\u7ae0\uff1a<a href=\"http:\/\/www.tgwttt.xyz\/?p=677\">http:\/\/www.tgwttt.xyz\/?p=677<\/a><\/p>\n<\/div>\n\n\n\n<p>\u5f15\u8a00\uff1a\u6700\u8fd1\u535a\u4e3b\u5728\u5199\u8bfe\u8bbe\uff0c\u5728\u5728web\u670d\u52a1\u65f6\uff0c\u95f2\u6765\u65e0\u4e8b\uff08\u540e\u7aef\u903b\u8f91\u7531\u5ba4\u53cb\u7528java\u5199\u4e86\u63d2\u4e0d\u4e0a\u624b\uff09,\u4e8e\u662f\u60f3\u7740\u81ea\u5df1\u5199\u4e00\u4e2a\u7c7b\u4f3cnginx\u7684\u4ee3\u7406\u670d\u52a1\u5668,\u7531\u4e8e\u6761\u4ef6\u6709\u9650\uff0c\u6ca1\u6709\u505a\u8d1f\u8f7d\u5747\u8861\u903b\u8f91\u3002<\/p>\n\n\n\n<p>\u603b\u4f53\u8bbe\u8ba1\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"506\" src=\"http:\/\/www.tgwttt.xyz\/wp-content\/uploads\/2025\/12\/image-1024x506.png\" alt=\"\" class=\"wp-image-1030\" srcset=\"https:\/\/www.tgwttt.xyz\/wp-content\/uploads\/2025\/12\/image-1024x506.png 1024w, https:\/\/www.tgwttt.xyz\/wp-content\/uploads\/2025\/12\/image-300x148.png 300w, https:\/\/www.tgwttt.xyz\/wp-content\/uploads\/2025\/12\/image-768x380.png 768w, https:\/\/www.tgwttt.xyz\/wp-content\/uploads\/2025\/12\/image.png 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728\u7f51\u7edc\u901a\u4fe1\u4e2d\uff0c\u4ee3\u7406\u670d\u52a1\u5668\u626e\u6f14\u7740\u91cd\u8981\u7684\u89d2\u8272\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8e\u8d1f\u8f7d\u5747\u8861\u3001\u5b89\u5168\u8fc7\u6ee4\u3001\u7f13\u5b58\u52a0\u901f\u3001\u7f51\u7edc\u7a7f\u900f\u7b49\u591a\u79cd\u573a\u666f\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u4e2a\u57fa\u4e8eReactor\u6a21\u5f0f\u5b9e\u73b0\u7684\u9ad8\u6027\u80fdTCP\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u8be5\u670d\u52a1\u5668\u91c7\u7528\u4e86\u591a\u7ebf\u7a0b\u67b6\u6784\u3001\u975e\u963b\u585eIO\u548c\u4e8b\u4ef6\u9a71\u52a8\u6a21\u578b\uff0c\u80fd\u591f\u9ad8\u6548\u5730\u5904\u7406\u5927\u91cf\u5e76\u53d1\u8fde\u63a5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u00a0\u67b6\u6784\u8bbe\u8ba1<\/strong><\/h2>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>R<strong>eactor\u6a21\u5f0f<\/strong><\/p>\n\n\n\n<p>Reactor\u6a21\u5f0f\u662f\u4e00\u79cd\u4e8b\u4ef6\u9a71\u52a8\u7684\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u4e3b\u8981\u7528\u4e8e\u5904\u7406\u5e76\u53d1\u8fde\u63a5\u3002\u5b83\u7684\u6838\u5fc3\u601d\u60f3\u662f\u5c06\u4e8b\u4ef6\u7684\u68c0\u6d4b\u548c\u5904\u7406\u5206\u79bb\uff0c\u901a\u8fc7\u4e00\u4e2a\u4e8b\u4ef6\u5faa\u73af\u6765\u76d1\u542c\u548c\u5206\u53d1\u4e8b\u4ef6\u3002<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>\u5728\u6211\u7684\u4ee3\u7406\u670d\u52a1\u5668\u4e2d\uff0cReactor\u6a21\u5f0f\u7684\u5b9e\u73b0\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a\u90e8\u5206\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>1. <strong>\u4e8b\u4ef6\u6e90<\/strong>\uff1a\u7f51\u7edc\u8fde\u63a5\uff08socket\uff09<\/p>\n\n\n\n<p>2. <strong>\u4e8b\u4ef6\u591a\u8def\u5206\u53d1\u5668<\/strong>\uff1aepoll<\/p>\n\n\n\n<p>3. <strong>\u4e8b\u4ef6\u5904\u7406\u5668<\/strong>\uff1aChannel\u7c7b<\/p>\n\n\n\n<p>4. <strong>\u5206\u53d1\u5668<\/strong>\uff1aReactor\u7c7b<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p><strong>\u591a\u7ebf\u7a0b\u67b6\u6784<\/strong>:<\/p>\n\n\n\n<p>1. <strong>\u4e3b\u7ebf\u7a0b\uff08Master Reactor\uff09**<\/strong>\uff1a\u8d1f\u8d23\u76d1\u542c\u65b0\u7684\u5ba2\u6237\u7aef\u8fde\u63a5<\/p>\n\n\n\n<p>2. <strong>\u5de5\u4f5c\u7ebf\u7a0b\uff08Worker Reactor\uff09**<\/strong>\uff1a\u8d1f\u8d23\u5904\u7406\u5df2\u5efa\u7acb\u7684\u8fde\u63a5\u7684\u6570\u636e\u4f20\u8f93<\/p>\n\n\n\n<p>\u8fd9\u79cd\u8bbe\u8ba1\u5c06\u8fde\u63a5\u7684\u5efa\u7acb\u548c\u6570\u636e\u7684\u5904\u7406\u5206\u79bb\uff0c\u907f\u514d\u4e86\u4e3b\u7ebf\u7a0b\u7684\u963b\u585e\uff0c\u63d0\u9ad8\u4e86\u670d\u52a1\u5668\u7684\u5e76\u53d1\u5904\u7406\u80fd\u529b\u3002<\/p>\n<\/div>\n\n\n\n<p><strong>\u6838\u5fc3\u7ec4\u4ef6<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p><strong>Common.hpp<\/strong><\/p>\n\n\n\n<p>Common.hpp\u5b9a\u4e49\u4e86\u4e00\u4e9b\u901a\u7528\u7684\u5de5\u5177\u7c7b\u548c\u51fd\u6570\uff1a<\/p>\n\n\n\n<p>&#8211;<strong>NetAddr\u7c7b<\/strong>\uff1a\u5c01\u88c5\u4e86\u7f51\u7edc\u5730\u5740\u7684\u5904\u7406\uff0c\u5305\u62ecIP\u548c\u7aef\u53e3\u7684\u8bbe\u7f6e\u3001\u8f6c\u6362\u548c\u83b7\u53d6<\/p>\n\n\n\n<p>&#8211; <strong>NoCopy\u7c7b<\/strong>\uff1a\u7981\u6b62\u5bf9\u8c61\u7684\u62f7\u8d1d\u548c\u8d4b\u503c\u64cd\u4f5c\uff0c\u7528\u4e8e\u8d44\u6e90\u7ba1\u7406<\/p>\n\n\n\n<p>&#8211; <strong>SetNonBlock\u51fd\u6570<\/strong>\uff1a\u5c06\u6587\u4ef6\u63cf\u8ff0\u7b26\u8bbe\u7f6e\u4e3a\u975e\u963b\u585e\u6a21\u5f0f<\/p>\n<\/div>\n\n\n\n<p><strong>Connection.hpp<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>Connection.hpp\u5b9a\u4e49\u4e86\u8fde\u63a5\u7684\u62bd\u8c61\u63a5\u53e3\uff1a<\/p>\n\n\n\n<p>class Connection<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>public:<\/p>\n\n\n\n<p>&nbsp; &nbsp; using handler_t =std::function&lt;void(std::shared_ptr&lt;Channel&gt;)&gt;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; Connection():handler(nullptr),events(0), owner(nullptr) {}<\/p>\n\n\n\n<p>&nbsp; &nbsp; virtual void Recever() = 0;<\/p>\n\n\n\n<p>&nbsp; &nbsp; virtual void Sender() = 0;<\/p>\n\n\n\n<p>&nbsp; &nbsp; virtual void Excepter() = 0;<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ \u5176\u4ed6\u6210\u5458\u51fd\u6570&#8230;<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p>\u6240\u6709\u5177\u4f53\u7684\u8fde\u63a5\u7c7b\u578b\uff08\u5982Channel\uff09\u90fd\u5fc5\u987b\u5b9e\u73b0\u8fd9\u4e2a\u63a5\u53e3\u3002<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p><strong>Channel.hpp<\/strong><\/p>\n\n\n\n<p>Channel\u7c7b\u662fConnection\u63a5\u53e3\u7684\u5177\u4f53\u5b9e\u73b0\uff0c\u8d1f\u8d23\u5904\u7406\u5355\u4e2a\u8fde\u63a5\u7684\u6570\u636e\u4f20\u8f93\uff1a<\/p>\n\n\n\n<p>&#8211; <strong>Recever\u65b9\u6cd5<\/strong>\uff1a\u63a5\u6536\u6765\u81ea\u5ba2\u6237\u7aef\u6216\u76ee\u6807\u670d\u52a1\u5668\u7684\u6570\u636e<\/p>\n\n\n\n<p>&#8211; <strong>Sender\u65b9\u6cd5<\/strong>\uff1a\u53d1\u9001\u6570\u636e\u5230\u5ba2\u6237\u7aef\u6216\u76ee\u6807\u670d\u52a1\u5668<\/p>\n\n\n\n<p>&#8211; <strong>Excepter\u65b9\u6cd5<\/strong>\uff1a\u5904\u7406\u5f02\u5e38\u60c5\u51b5\uff0c\u5982\u8fde\u63a5\u5173\u95ed<\/p>\n\n\n\n<p>\u5728\u4ee3\u7406\u670d\u52a1\u5668\u6a21\u5f0f\u4e0b\uff0c\u6bcf\u4e2aChannel\u90fd\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684peerChannel\uff0c\u7528\u4e8e\u5b9e\u73b0\u6570\u636e\u7684\u53cc\u5411\u8f6c\u53d1\uff1a<\/p>\n\n\n\n<p>\/\/ \u8bbe\u7f6e\u5bf9\u7aefChannel<\/p>\n\n\n\n<p>void setPeerChannel(std::shared_ptr&lt;Channel&gt; peer) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; this-&gt;peerChannel = peer;<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ \u5efa\u7acb\u53cc\u5411\u5173\u8054<\/p>\n\n\n\n<p>&nbsp; &nbsp; if (peer) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; peer-&gt;peerChannel = shared_from_this();<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>}<\/p>\n<\/div>\n\n\n\n<p><strong>Reactor.hpp<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>Reactor\u7c7b\u662f\u6574\u4e2a\u4e8b\u4ef6\u9a71\u52a8\u6a21\u578b\u7684\u6838\u5fc3\uff0c\u8d1f\u8d23\u4e8b\u4ef6\u7684\u76d1\u542c\u548c\u5206\u53d1\uff1a<\/p>\n\n\n\n<p>void Loop()<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>&nbsp; &nbsp; isRunning = true;<\/p>\n\n\n\n<p>&nbsp; &nbsp; while (isRunning)<\/p>\n\n\n\n<p>&nbsp; &nbsp; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; int timeout = -1;<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>&nbsp; &nbsp; &nbsp; &nbsp; int n=LoopOnce(timeout);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Dispatch(n);<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; isRunning = false;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>Loop\u65b9\u6cd5\u662f\u4e8b\u4ef6\u5faa\u73af\u7684\u4e3b\u5165\u53e3\uff0c\u5b83\u4e0d\u65ad\u5730\u8c03\u7528LoopOnce\u65b9\u6cd5\u83b7\u53d6\u5c31\u7eea\u7684\u4e8b\u4ef6\uff0c\u7136\u540e\u8c03\u7528Dispatch\u65b9\u6cd5\u5206\u53d1\u8fd9\u4e9b\u4e8b\u4ef6\u5230\u5bf9\u5e94\u7684\u5904\u7406\u5668\u3002<\/p>\n\n\n\n<p>\u5728\u4ee3\u7406\u670d\u52a1\u5668\u6a21\u5f0f\u4e0b\uff0cReactor\u7c7b\u8fd8\u8d1f\u8d23\u8fde\u63a5\u5230\u76ee\u6807\u670d\u52a1\u5668\uff1a<\/p>\n\n\n\n<p>&#8220;`cpp<\/p>\n\n\n\n<p>std::shared_ptr&lt;Channel&gt; connectToTargetServer(const std::string&amp; targetAddr, int targetPort) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ \u521b\u5efasocket\u5e76\u8fde\u63a5\u5230\u76ee\u6807\u670d\u52a1\u5668<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ &#8230;<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ \u521b\u5efaChannel\u5bf9\u8c61<\/p>\n\n\n\n<p>&nbsp; &nbsp; std::shared_ptr&lt;Channel&gt; channel = std::make_shared&lt;Channel&gt;(sockfd, targetAddr, targetPort);<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ &#8230;<\/p>\n\n\n\n<p>&nbsp; &nbsp; return channel;<\/p>\n\n\n\n<p>}<\/p>\n<\/div>\n<\/div>\n\n\n\n<p><strong>Listener.hpp<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>Listener\u7c7b\u8d1f\u8d23\u76d1\u542c\u65b0\u7684\u5ba2\u6237\u7aef\u8fde\u63a5\uff0c\u5e76\u5c06\u5b83\u4eec\u5206\u53d1\u7ed9\u5de5\u4f5c\u7ebf\u7a0b\uff1a<\/p>\n\n\n\n<p>void Recever() override<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>&nbsp; &nbsp; NetAddr client_addr;<\/p>\n\n\n\n<p>&nbsp; &nbsp; while (true)<\/p>\n\n\n\n<p>&nbsp; &nbsp; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; int client_fd = listen_socket-&gt;Accept(&amp;client_addr);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; \/\/ &#8230;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u5408\u6cd5\u7684fd\uff0c\u4f7f\u7528\u8f6e\u8be2\u65b9\u5f0f\u5206\u53d1\u7ed9\u5de5\u4f5c\u7ebf\u7a0b<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; if (!workerReactors.empty()) {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetNonBlock(client_fd);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::shared_ptr&lt;Reactor&gt; reactor = workerReactors[nextWorkerIndex];<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reactor-&gt;addSocketFd(client_fd);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nextWorkerIndex = (nextWorkerIndex + 1) % workerReactors.size();<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>}<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p><strong>\u4ee3\u7406\u5de5\u4f5c\u539f\u7406<\/strong><\/p>\n\n\n\n<p>\u5f53\u4ee3\u7406\u670d\u52a1\u5668\u63a5\u6536\u5230\u5ba2\u6237\u7aef\u7684\u8fde\u63a5\u8bf7\u6c42\u65f6\uff0c\u5b83\u4f1a\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<p>1. <strong>\u63a5\u6536\u8fde\u63a5<\/strong>\uff1aListener\u7c7b\u7684Recever\u65b9\u6cd5\u63a5\u6536\u5ba2\u6237\u7aef\u7684\u8fde\u63a5\u8bf7\u6c42\uff0c\u5e76\u5c06\u5ba2\u6237\u7aef\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u5206\u53d1\u7ed9\u5de5\u4f5c\u7ebf\u7a0b\u3002<\/p>\n\n\n\n<p>2. <strong>\u521b\u5efaChannel<\/strong>\uff1a\u5de5\u4f5c\u7ebf\u7a0b\u7684Reactor\u521b\u5efa\u4e00\u4e2aChannel\u5bf9\u8c61\u6765\u7ba1\u7406\u8fd9\u4e2a\u8fde\u63a5\u3002<\/p>\n\n\n\n<p>3. <strong>\u8fde\u63a5\u76ee\u6807\u670d\u52a1\u5668<\/strong>\uff1a\u5982\u679c\u662f\u4ee3\u7406\u6a21\u5f0f\uff0cReactor\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684socket\u8fde\u63a5\u5230\u76ee\u6807\u670d\u52a1\u5668\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u5bf9\u5e94\u7684Channel\u5bf9\u8c61\u3002<\/p>\n\n\n\n<p>4. <strong>\u5efa\u7acb\u5173\u8054<\/strong>\uff1a\u5ba2\u6237\u7aef\u7684Channel\u548c\u76ee\u6807\u670d\u52a1\u5668\u7684Channel\u5efa\u7acb\u53cc\u5411\u5173\u8054\uff0c\u5f62\u6210\u4e00\u4e2a\u4ee3\u7406\u94fe\u8def\u3002<\/p>\n\n\n\n<p>5. <strong>\u6570\u636e\u8f6c\u53d1<\/strong>\uff1a\u5f53\u5ba2\u6237\u7aef\u53d1\u9001\u6570\u636e\u65f6\uff0c\u5ba2\u6237\u7aef\u7684Channel\u63a5\u6536\u5230\u6570\u636e\u540e\uff0c\u4f1a\u5c06\u6570\u636e\u8f6c\u53d1\u5230\u76ee\u6807\u670d\u52a1\u5668\u7684Channel\uff1b\u5f53\u76ee\u6807\u670d\u52a1\u5668\u8fd4\u56de\u6570\u636e\u65f6\uff0c\u76ee\u6807\u670d\u52a1\u5668\u7684Channel\u63a5\u6536\u5230\u6570\u636e\u540e\uff0c\u4f1a\u5c06\u6570\u636e\u8f6c\u53d1\u5230\u5ba2\u6237\u7aef\u7684Channel\u3002<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p><strong>\u6027\u80fd\u4f18\u5316<\/strong><\/p>\n\n\n\n<p>1. <strong>\u975e\u963b\u585eIO<\/strong>\uff1a\u6240\u6709\u7684socket\u90fd\u8bbe\u7f6e\u4e3a\u975e\u963b\u585e\u6a21\u5f0f\uff0c\u907f\u514d\u4e86IO\u64cd\u4f5c\u7684\u963b\u585e\u3002<\/p>\n\n\n\n<p>2. <strong>ET\u6a21\u5f0f<\/strong>\uff1aepoll\u4f7f\u7528\u8fb9\u7f18\u89e6\u53d1\u6a21\u5f0f\uff0c\u53ef\u4ee5\u51cf\u5c11\u4e8b\u4ef6\u7684\u89e6\u53d1\u6b21\u6570\uff0c\u63d0\u9ad8\u6548\u7387\u3002<\/p>\n\n\n\n<p>3. <strong>\u591a\u7ebf\u7a0b<\/strong>\uff1a\u91c7\u7528\u591a\u7ebf\u7a0b\u67b6\u6784\uff0c\u5c06\u8fde\u63a5\u7684\u5efa\u7acb\u548c\u6570\u636e\u7684\u5904\u7406\u5206\u79bb\uff0c\u63d0\u9ad8\u4e86\u670d\u52a1\u5668\u7684\u5e76\u53d1\u5904\u7406\u80fd\u529b\u3002<\/p>\n\n\n\n<p>4. <strong>\u4e8b\u4ef6\u9a71<\/strong>\u52a8\uff1a\u4f7f\u7528\u4e8b\u4ef6\u9a71\u52a8\u6a21\u578b\uff0c\u53ea\u6709\u5f53\u6709\u4e8b\u4ef6\u53d1\u751f\u65f6\u624d\u4f1a\u5904\u7406\uff0c\u907f\u514d\u4e86\u8f6e\u8be2\u7684\u5f00\u9500\u3002<\/p>\n\n\n\n<p>5. <strong>\u6570\u636e\u7f13\u51b2\u533a<\/strong>\uff1a\u4f7f\u7528\u7f13\u51b2\u533a\u6765\u5b58\u50a8\u6570\u636e\uff0c\u51cf\u5c11\u4e86\u7cfb\u7edf\u8c03\u7528\u7684\u6b21\u6570\u3002<\/p>\n<\/div>\n\n\n\n<p>\u4eca\u5929\u7684\u66f4\u65b0\u5c31\u5230\u8fd9\u91cc\uff0c\u5982\u6709\u9519\u8bef\u6b22\u996e\u6307\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee3\u7801\u5730\u5740\uff1ahttps:\/\/gitee.com\/tgwTTT\/super-238\/tree\/server\/Tcp&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1030,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1029","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1029"}],"version-history":[{"count":3,"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1029\/revisions"}],"predecessor-version":[{"id":1443,"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1029\/revisions\/1443"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=\/wp\/v2\/media\/1030"}],"wp:attachment":[{"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tgwttt.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}