{"id":16866,"date":"2025-04-18T23:17:11","date_gmt":"2025-04-18T15:17:11","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/16866.html"},"modified":"2025-04-18T23:17:11","modified_gmt":"2025-04-18T15:17:11","slug":"%e3%80%90cboostasio%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b%e3%80%91%e4%bd%bf%e7%94%a8asio%e5%8d%8f%e7%a8%8b%e6%90%ad%e5%bb%ba%e5%bc%82%e6%ad%a5echo%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84%e7%ac%94","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/16866.html","title":{"rendered":"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0"},"content":{"rendered":"<\/p>\n<h4>\u3010C&#043;&#043;boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65\u670d\u52a1\u5668\u7684\u7b14\u8bb0<\/h4>\n<ul>\n<li>\u534f\u7a0b\u548c\u7ebf\u7a0b\u5173\u7cfb\u4ee5\u53ca\u7ebf\u7a0b\u548c\u8fdb\u7a0b\u7684\u5173\u7cfb\u7b80\u5355\u533a\u5206<\/li>\n<li>\n<ul>\n<li>\u8d44\u6e90\u6d88\u8017\u4e0e\u5f00\u9500<\/li>\n<li>\u8c03\u5ea6\u4e0e\u4e0a\u4e0b\u6587\u5207\u6362<\/li>\n<li>\u5e76\u53d1\u6027<\/li>\n<li>\u72ec\u7acb\u6027<\/li>\n<\/ul>\n<\/li>\n<li>main\u51fd\u6570<\/li>\n<li>listener\u51fd\u6570<\/li>\n<li>echo\u51fd\u6570<\/li>\n<\/ul>\n<h2>\u534f\u7a0b\u548c\u7ebf\u7a0b\u5173\u7cfb\u4ee5\u53ca\u7ebf\u7a0b\u548c\u8fdb\u7a0b\u7684\u5173\u7cfb\u7b80\u5355\u533a\u5206<\/h2>\n<h3>\u8d44\u6e90\u6d88\u8017\u4e0e\u5f00\u9500<\/h3>\n<ul>\n<li>\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u8fdb\u7a0b \u662f\u64cd\u4f5c\u7cfb\u7edf\u5206\u914d\u8d44\u6e90\u7684\u57fa\u672c\u5355\u4f4d&#xff0c;\u6bcf\u4e2a\u8fdb\u7a0b\u62e5\u6709\u81ea\u5df1\u7684\u5185\u5b58\u7a7a\u95f4\u3001\u6587\u4ef6\u63cf\u8ff0\u7b26\u7b49\u8d44\u6e90\u3002<\/li>\n<li>\u7ebf\u7a0b \u662f\u8fdb\u7a0b\u4e2d\u7684\u6267\u884c\u5355\u5143&#xff0c;\u540c\u4e00\u4e2a\u8fdb\u7a0b\u4e2d\u7684\u591a\u4e2a\u7ebf\u7a0b\u5171\u4eab\u8fdb\u7a0b\u7684\u8d44\u6e90&#xff08;\u5982\u5185\u5b58\u7a7a\u95f4\u3001\u6587\u4ef6\u63cf\u8ff0\u7b26\u7b49&#xff09;\u3002\u7ebf\u7a0b\u7684\u521b\u5efa\u548c\u4e0a\u4e0b\u6587\u5207\u6362\u76f8\u5bf9\u4e8e\u8fdb\u7a0b\u6765\u8bf4&#xff0c;\u5f00\u9500\u8f83\u5c0f&#xff0c;\u4f46\u4ecd\u7136\u9700\u8981\u64cd\u4f5c\u7cfb\u7edf\u7684\u652f\u6301\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u534f\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u534f\u7a0b \u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u7528\u6237\u7ea7\u6267\u884c\u5355\u5143&#xff0c;\u5b83\u4e0e\u7ebf\u7a0b\u76f8\u6bd4&#xff0c;\u5177\u6709\u66f4\u5c0f\u7684\u8d44\u6e90\u5f00\u9500\u3002\u591a\u4e2a\u534f\u7a0b\u901a\u5e38\u8fd0\u884c\u5728\u4e00\u4e2a\u7ebf\u7a0b\u4e2d&#xff0c;\u5171\u4eab\u7ebf\u7a0b\u7684\u8d44\u6e90&#xff08;\u5982 CPU \u65f6\u95f4\u3001\u5185\u5b58\u7b49&#xff09;\u3002<\/li>\n<li>\u7ebf\u7a0b \u662f\u64cd\u4f5c\u7cfb\u7edf\u8c03\u5ea6\u7684\u57fa\u672c\u5355\u5143&#xff0c;\u534f\u7a0b\u662f\u5728\u7528\u6237\u7ea7\u522b\u8fdb\u884c\u8c03\u5ea6\u7684&#xff0c;\u5b83\u5e76\u4e0d\u4f9d\u8d56\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u4e0a\u4e0b\u6587\u5207\u6362\u3002\u56e0\u6b64&#xff0c;\u534f\u7a0b\u7684\u5207\u6362\u548c\u8c03\u5ea6\u5f00\u9500\u6bd4\u7ebf\u7a0b\u5c0f\u5f97\u591a\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u8c03\u5ea6\u4e0e\u4e0a\u4e0b\u6587\u5207\u6362<\/h3>\n<ul>\n<li>\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u8fdb\u7a0b \u548c \u7ebf\u7a0b \u7684\u8c03\u5ea6\u901a\u5e38\u7531\u64cd\u4f5c\u7cfb\u7edf\u7ba1\u7406&#xff0c;\u7ebf\u7a0b\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u6d89\u53ca\u5230\u4fdd\u5b58\u548c\u6062\u590d CPU \u5bc4\u5b58\u5668\u3001\u5185\u5b58\u6620\u5c04\u7b49\u72b6\u6001\u3002<\/li>\n<li>\u7ebf\u7a0b\u5207\u6362 \u7684\u5f00\u9500\u6bd4\u8fdb\u7a0b\u5207\u6362\u5c0f&#xff0c;\u4f46\u4ecd\u7136\u9700\u8981\u64cd\u4f5c\u7cfb\u7edf\u7684\u5e72\u9884\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u534f\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u534f\u7a0b \u7684\u8c03\u5ea6\u901a\u5e38\u662f\u7531\u7a0b\u5e8f\u81ea\u8eab\u7ba1\u7406\u7684&#xff0c;\u534f\u7a0b\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u4e0d\u9700\u8981\u64cd\u4f5c\u7cfb\u7edf\u7684\u53c2\u4e0e&#xff0c;\u901a\u5e38\u53ea\u662f\u901a\u8fc7\u4fdd\u5b58\u548c\u6062\u590d\u5c11\u91cf\u7684\u72b6\u6001&#xff08;\u4f8b\u5982\u5c40\u90e8\u53d8\u91cf\u3001\u7a0b\u5e8f\u8ba1\u6570\u5668\u7b49&#xff09;\u6765\u5b8c\u6210\u3002\u56e0\u6b64&#xff0c;\u534f\u7a0b\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u6bd4\u7ebf\u7a0b\u5207\u6362\u7684\u5f00\u9500\u66f4\u5c0f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u5e76\u53d1\u6027<\/h3>\n<ul>\n<li>\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u8fdb\u7a0b \u4e4b\u95f4\u662f\u5b8c\u5168\u72ec\u7acb\u7684&#xff0c;\u4e00\u4e2a\u8fdb\u7a0b\u7684\u5d29\u6e83\u4e0d\u4f1a\u76f4\u63a5\u5f71\u54cd\u5230\u5176\u4ed6\u8fdb\u7a0b\u3002<\/li>\n<li>\u7ebf\u7a0b \u4e4b\u95f4\u662f\u5e76\u53d1\u7684&#xff0c;\u5728\u540c\u4e00\u8fdb\u7a0b\u4e2d\u53ef\u4ee5\u5e76\u884c\u6267\u884c\u591a\u4e2a\u7ebf\u7a0b&#xff08;\u5728\u591a\u6838 CPU \u4e0a&#xff0c;\u591a\u4e2a\u7ebf\u7a0b\u53ef\u4ee5\u771f\u6b63\u5730\u5e76\u884c\u8fd0\u884c&#xff09;&#xff0c;\u4f46\u662f\u5b83\u4eec\u4f1a\u5171\u4eab\u8fdb\u7a0b\u7684\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u534f\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u534f\u7a0b \u662f\u8f7b\u91cf\u7ea7\u7684\u5e76\u53d1\u5355\u5143&#xff0c;\u5b83\u4eec\u8fd0\u884c\u5728\u5355\u4e2a\u7ebf\u7a0b\u4e2d\u3002<font color=\"red\">\u591a\u4e2a\u534f\u7a0b\u53ef\u4ee5\u5728\u540c\u4e00\u4e2a\u7ebf\u7a0b\u4e2d\u5e76\u53d1\u6267\u884c&#xff0c;\u4f46\u5b83\u4eec\u5e76\u4e0d\u4f1a\u5e76\u884c\u6267\u884c&#xff08;\u5373\u4e0d\u4f1a\u5728\u591a\u4e2a CPU \u6838\u5fc3\u4e0a\u540c\u65f6\u8fd0\u884c&#xff09;<\/font>\u3002\u534f\u7a0b\u901a\u8fc7\u534f\u4f5c\u5f0f\u8c03\u5ea6\u6765\u5b9e\u73b0\u5e76\u53d1&#xff0c;\u901a\u5e38\u5728 I\/O \u64cd\u4f5c\u6216\u8005\u5176\u4ed6\u9700\u8981\u7b49\u5f85\u7684\u5730\u65b9\u6302\u8d77&#xff0c;\u7ed9\u5176\u4ed6\u534f\u7a0b\u6267\u884c\u7684\u673a\u4f1a\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u72ec\u7acb\u6027<\/h3>\n<ul>\n<li>\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u8fdb\u7a0b \u662f\u72ec\u7acb\u7684&#xff0c;\u901a\u5e38\u4e0d\u4f1a\u76f4\u63a5\u5171\u4eab\u5185\u5b58\u7b49\u8d44\u6e90&#xff0c;\u8fdb\u7a0b\u95f4\u7684\u901a\u4fe1\u9700\u8981\u901a\u8fc7\u7279\u5b9a\u7684\u673a\u5236&#xff08;\u5982\u7ba1\u9053\u3001\u6d88\u606f\u961f\u5217\u3001\u5171\u4eab\u5185\u5b58\u7b49&#xff09;\u3002<\/li>\n<li>\u7ebf\u7a0b \u5171\u4eab\u8fdb\u7a0b\u7684\u5185\u5b58\u7a7a\u95f4&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u5171\u4eab\u6570\u636e&#xff0c;\u56e0\u6b64\u7ebf\u7a0b\u4e4b\u95f4\u7684\u901a\u4fe1\u8f83\u4e3a\u65b9\u4fbf&#xff0c;\u4f46\u4e5f\u9700\u8981\u6ce8\u610f\u540c\u6b65\u95ee\u9898\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u534f\u7a0b\u4e0e\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u534f\u7a0b <font color=\"red\">\u4e0d\u72ec\u7acb&#xff0c;\u5b83\u4eec\u5171\u4eab\u540c\u4e00\u4e2a\u7ebf\u7a0b\u7684\u8d44\u6e90<\/font>\u3002\u591a\u4e2a\u534f\u7a0b\u4e4b\u95f4\u7684\u5207\u6362\u4e0d\u4f1a\u6d89\u53ca\u5230\u7ebf\u7a0b\u7684\u4e0a\u4e0b\u6587\u5207\u6362&#xff0c;\u53ea\u662f\u5728\u534f\u7a0b\u4e4b\u95f4\u7684\u5207\u6362\u3002\u534f\u7a0b\u4e4b\u95f4\u901a\u5e38\u901a\u8fc7\u5171\u4eab\u5185\u5b58\u6765\u901a\u4fe1&#xff0c;\u4f46\u4e5f\u9700\u8981\u5c0f\u5fc3\u907f\u514d\u5e76\u53d1\u95ee\u9898\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>main\u51fd\u6570<\/h2>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">try<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\nboost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>io_context ioc<span class=\"token punctuation\">;<\/span><br \/>\nboost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>signal_set <span class=\"token function\">signals<\/span><span class=\"token punctuation\">(<\/span>ioc<span class=\"token punctuation\">,<\/span> SIGINT<span class=\"token punctuation\">,<\/span> SIGTERM<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nsignals<span class=\"token punctuation\">.<\/span><span class=\"token function\">async_wait<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token operator\">&amp;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">auto<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">auto<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\nioc<span class=\"token punctuation\">.<\/span><span class=\"token function\">stop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nboost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">co_spawn<\/span><span class=\"token punctuation\">(<\/span>ioc<span class=\"token punctuation\">,<\/span> listener<span class=\"token punctuation\">,<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>detached<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nioc<span class=\"token punctuation\">.<\/span><span class=\"token function\">run<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">const<\/span> std<span class=\"token double-colon punctuation\">::<\/span>exception<span class=\"token operator\">&amp;<\/span> e<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\nstd<span class=\"token double-colon punctuation\">::<\/span>cout <span class=\"token operator\">&lt;&lt;<\/span> e<span class=\"token punctuation\">.<\/span><span class=\"token function\">what<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&lt;&lt;<\/span> std<span class=\"token double-colon punctuation\">::<\/span>endl<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">co_spawn<\/span><span class=\"token punctuation\">(<\/span>ioc<span class=\"token punctuation\">,<\/span> listener<span class=\"token punctuation\">,<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>detached<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u8fd9\u6bb5\u4ee3\u7801\u7684\u4e3b\u8981\u529f\u80fd\u662f\u542f\u52a8\u4e00\u4e2a\u65b0\u7684\u534f\u7a0b\u6765\u8fd0\u884clistener\u51fd\u6570(\u8fd9\u4e2a\u51fd\u6570\u7528\u6765\u76d1\u542c\u6765\u81ea\u5ba2\u6237\u7aef\u7684\u8fde\u63a5)&#xff0c;<\/p>\n<h2>listener\u51fd\u6570<\/h2>\n<p>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>awaitable<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">void<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token function\">listener<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">auto<\/span> executor <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">co_await<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>this_coro<span class=\"token double-colon punctuation\">::<\/span>executor<span class=\"token punctuation\">;<\/span><br \/>\nboost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>ip<span class=\"token double-colon punctuation\">::<\/span>tcp<span class=\"token double-colon punctuation\">::<\/span>acceptor <span class=\"token function\">acceptor<\/span><span class=\"token punctuation\">(<\/span>executor<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>ip<span class=\"token double-colon punctuation\">::<\/span>tcp<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">v4<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><span class=\"token number\">8888<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token boolean\">true<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\nboost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>ip<span class=\"token double-colon punctuation\">::<\/span>tcp<span class=\"token double-colon punctuation\">::<\/span>socket socket <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">co_await<\/span> acceptor<span class=\"token punctuation\">.<\/span><span class=\"token function\">async_accept<\/span><span class=\"token punctuation\">(<\/span>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>use_awaitable<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nboost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">co_spawn<\/span><span class=\"token punctuation\">(<\/span>executor<span class=\"token punctuation\">,<\/span> <span class=\"token function\">echo<\/span><span class=\"token punctuation\">(<\/span>std<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">move<\/span><span class=\"token punctuation\">(<\/span>socket<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>detached<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>awaitable<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">void<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token function\">listener<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u2003\u2003\u9996\u5148\u6765\u4ecb\u7ecd\u4e00\u4e0b\u8fd9\u4e2a\u8fd4\u56de\u503c\u4e3a\u4ec0\u4e48\u8981\u8fd9\u4e48\u5199&#xff1a;boost::asio::awaitable&lt;T&gt;\u662f\u4e00\u79cd\u534f\u7a0b\u8fd4\u56de\u7c7b\u578b&#xff0c;\u8868\u793a\u8be5\u51fd\u6570\u8fd4\u56de\u7684\u662f\u4e00\u4e2a\u53ef\u4ee5\u6302\u8d77\u7684\u534f\u7a0b \u4ec0\u4e48\u53eb\u505a\u8fd4\u56de\u4e00\u4e2a\u53ef\u4ee5\u6302\u8d77\u7684\u534f\u7a0b&#xff1f; \u2003\u2003\u8fd9\u4e2a\u610f\u601d\u5c31\u662f\u8bf4\u8be5\u51fd\u6570\u8fd4\u56de\u7684\u5bf9\u8c61\u80fd\u5728\u67d0\u4e2a\u70b9\u6682\u505c\u6267\u884c&#xff0c;\u7b49\u5f85\u67d0\u4e2a\u64cd\u4f5c(\u4f8b\u5982\u5f02\u6b65IO,\u7f51\u7edc\u8bf7\u6c42\u7b49)\u5b8c\u6210\u540e\u518d\u7ee7\u7eed\u6267\u884c&#xff0c;\u8fd9\u79cd\u7279\u6027\u662f\u73b0\u4ee3\u534f\u7a0b\u6a21\u578b\u4e2d\u7684\u6838\u5fc3\u6982\u5ff5\u3002\u5728C&#043;&#043;20\u4e2d&#xff0c;\u534f\u7a0b\u901a\u8fc7co_await,co_return\u7b49\u5173\u952e\u5b57\u6765\u5b9e\u73b0&#xff0c;\u4f8b\u5982co_await\u7528\u4e8e\u6302\u8d77\u5f53\u524d\u534f\u7a0b\u5e76\u7b49\u5f85\u4e00\u4e2a\u5f02\u6b65\u64cd\u4f5c\u5b8c\u6210\u3002 \u2003\u2003\u800c\u6302\u8d77\u6307\u7684\u662f\u534f\u7a0b\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d\u6682\u505c\u4e0b\u6765&#xff0c;\u7b49\u5f85\u67d0\u4e9b\u6761\u4ef6\u6216\u64cd\u4f5c\u5b8c\u6210&#xff0c;\u8fd9\u65f6&#xff0c;\u534f\u7a0b\u5c06\u4e0d\u4f1a\u5360\u7528CPU&#xff0c;\u5176\u4ed6\u4efb\u52a1\u53ef\u4ee5\u7ee7\u7eed\u6267\u884c&#xff0c;\u76f4\u5230\u6302\u8d77\u7684\u64cd\u4f5c\u5b8c\u6210\u4e4b\u540e&#xff0c;\u8be5\u534f\u7a0b\u624d\u4f1a\u6062\u590d\u6267\u884c<\/p>\n<p><span class=\"token keyword\">auto<\/span> executor <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">co_await<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>this_coro<span class=\"token double-colon punctuation\">::<\/span>executor<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u8fd9\u6bb5\u4ee3\u7801\u5c31\u662f\u7528\u6765\u83b7\u53d6\u5f53\u524d\u534f\u7a0b\u6240\u5728\u7684&#034;\u6267\u884c\u4e0a\u4e0b\u6587&#034;\u3002\u5728Boost::asio\u4e2d&#xff0c;executor\u662f\u4e00\u4e2a\u5bf9\u8c61&#xff0c;\u4e3b\u8981\u8d1f\u8d23\u8c03\u5ea6\u548c\u6267\u884c\u4efb\u52a1&#xff0c;\u5b83\u662fio_context\u6216io_service\u7684\u4e00\u90e8\u5206&#xff0c;\u786e\u4fdd\u5f02\u6b65\u4efb\u52a1\u80fd\u591f\u6267\u884c\u3002 \u2003\u2003co_await\u662f\u4e00\u4e2a\u534f\u7a0b\u64cd\u4f5c\u7b26&#xff0c;\u5b83\u7528\u6237\u6302\u8d77\u5f53\u524d\u534f\u7a0b&#xff0c;\u76f4\u5230\u7b49\u5f85\u7684\u5bf9\u8c61\u5b8c\u6210.\u901a\u8fc7co_wait&#xff0c;\u534f\u7a0b\u4e0d\u4f1a\u7acb\u5373\u8fd4\u56de&#xff0c;\u800c\u662f\u5c06\u63a7\u5236\u6743\u4ea4\u8fd8\u7ed9\u8c03\u7528\u8005&#xff0c;\u76f4\u5230\u83b7\u53d6\u5230\u6267\u884c\u5668\u5bf9\u8c61\u4e3a\u6b62\u3002<\/p>\n<p>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>ip<span class=\"token double-colon punctuation\">::<\/span>tcp<span class=\"token double-colon punctuation\">::<\/span>socket socket <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">co_await<\/span> acceptor<span class=\"token punctuation\">.<\/span><span class=\"token function\">async_accept<\/span><span class=\"token punctuation\">(<\/span>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>use_awaitable<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003async_accept\u4e2d\u7684\u53c2\u6570boost::asio::use_awaitable\u7684\u4e3b\u8981\u4f5c\u7528\u662f\u4f7f\u5f97async_accept\u80fd\u591f\u4e0eC&#043;&#043;20\u7684\u534f\u7a0b\u673a\u5236\u517c\u5bb9&#xff0c;\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d&#xff0c;\u5b83\u4f7f\u5f97async_accept\u8fd4\u56de\u7684\u662f\u4e00\u4e2aC&#043;&#043;20 \u534f\u7a0b\u673a\u5236\u4ea4\u4e92\u7684\u201c\u534f\u7a0b\u517c\u5bb9\u5bf9\u8c61\u201c&#xff0c;\u80fd\u591f\u5728\u5f02\u6b65\u64cd\u4f5c\u5b8c\u6210\u65f6\u7ee7\u7eed\u6267\u884c<\/p>\n<p>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">co_spawn<\/span><span class=\"token punctuation\">(<\/span>executor<span class=\"token punctuation\">,<\/span> <span class=\"token function\">echo<\/span><span class=\"token punctuation\">(<\/span>std<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">move<\/span><span class=\"token punctuation\">(<\/span>socket<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>detached<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u8fd9\u884c\u4ee3\u7801\u7684\u610f\u601d\u662f\u542f\u52a8\u4e00\u4e2a\u534f\u7a0b\u3002\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u6267\u884c\u5668\u5bf9\u8c61&#xff0c;\u7528\u6237\u63a7\u5236\u534f\u7a0b\u7684\u4e0a\u4e0b\u6587\u3002\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662fsocket\u5bf9\u8c61&#xff0c;\u8868\u793a\u521b\u5efa\u7684\u534f\u7a0b\u901a\u8fc7\u8fd9\u4e2a\u5bf9\u8c61\u4e3a\u5ba2\u6237\u7aef\u8fdb\u884c\u670d\u52a1&#xff0c;\u7b2c\u4e09\u4e2a\u53c2\u6570\u7684\u4f5c\u7528\u662f\u8868\u793a\u4e0d\u9700\u8981\u5173\u5fc3\u542f\u52a8\u7684\u8fd9\u4e2a\u534f\u7a0b\u5b8c\u6210\u7684\u60c5\u51b5\u3002<\/p>\n<h2>echo\u51fd\u6570<\/h2>\n<p>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>awaitable<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">void<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token function\">echo<\/span><span class=\"token punctuation\">(<\/span>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>ip<span class=\"token double-colon punctuation\">::<\/span>tcp<span class=\"token double-colon punctuation\">::<\/span>socket socket<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">try<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">char<\/span> data<span class=\"token punctuation\">[<\/span><span class=\"token number\">1024<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token boolean\">true<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\nsize_t n <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">co_await<\/span> socket<span class=\"token punctuation\">.<\/span><span class=\"token function\">async_read_some<\/span><span class=\"token punctuation\">(<\/span>boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">buffer<\/span><span class=\"token punctuation\">(<\/span>data<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>use_awaitable<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nstd<span class=\"token double-colon punctuation\">::<\/span>cout <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;\u5199\u56de\u53bb&#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> std<span class=\"token double-colon punctuation\">::<\/span>endl<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">co_await<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">async_write<\/span><span class=\"token punctuation\">(<\/span>socket<span class=\"token punctuation\">,<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">buffer<\/span><span class=\"token punctuation\">(<\/span>data<span class=\"token punctuation\">,<\/span> n<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> boost<span class=\"token double-colon punctuation\">::<\/span>asio<span class=\"token double-colon punctuation\">::<\/span>use_awaitable<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">const<\/span> std<span class=\"token double-colon punctuation\">::<\/span>exception<span class=\"token operator\">&amp;<\/span> e<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\nstd<span class=\"token double-colon punctuation\">::<\/span>cout <span class=\"token operator\">&lt;&lt;<\/span> e<span class=\"token punctuation\">.<\/span><span class=\"token function\">what<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&lt;&lt;<\/span> std<span class=\"token double-colon punctuation\">::<\/span>endl<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u2003\u2003echo\u51fd\u6570\u7684\u4f5c\u7528\u5c31\u662f\u63a5\u6536\u5ba2\u6237\u7aef\u53d1\u8fc7\u6765\u7684\u4fe1\u606f\u7136\u540e\u8f6c\u53d1\u56de\u53bb&#xff0c;\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684echo server\u670d\u52a1\u5668\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.4k\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u4e86\u6709\u5173\u4e8eC++ boost\u5e93\u4e2d\u6709\u5173\u534f\u7a0b\u65b9\u9762\u7684\u77e5\u8bc6_boostasio\u7f51\u7edc\u7f16\u7a0b\u5f02\u6b65<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,43,78],"topic":[],"class_list":["post-16866","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-43","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/16866.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.4k\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u4e86\u6709\u5173\u4e8eC++ boost\u5e93\u4e2d\u6709\u5173\u534f\u7a0b\u65b9\u9762\u7684\u77e5\u8bc6_boostasio\u7f51\u7edc\u7f16\u7a0b\u5f02\u6b65\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/16866.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T15:17:11+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16866.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/16866.html\",\"name\":\"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T15:17:11+00:00\",\"dateModified\":\"2025-04-18T15:17:11+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/16866.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/16866.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16866.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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":"https:\/\/www.wsisp.com\/helps\/16866.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.4k\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf17\u6b21\u3002\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u4e86\u6709\u5173\u4e8eC++ boost\u5e93\u4e2d\u6709\u5173\u534f\u7a0b\u65b9\u9762\u7684\u77e5\u8bc6_boostasio\u7f51\u7edc\u7f16\u7a0b\u5f02\u6b65","og_url":"https:\/\/www.wsisp.com\/helps\/16866.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T15:17:11+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/16866.html","url":"https:\/\/www.wsisp.com\/helps\/16866.html","name":"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T15:17:11+00:00","dateModified":"2025-04-18T15:17:11+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/16866.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/16866.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/16866.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010C++boost::asio\u7f51\u7edc\u7f16\u7a0b\u3011\u4f7f\u7528asio\u534f\u7a0b\u642d\u5efa\u5f02\u6b65echo\u670d\u52a1\u5668\u7684\u7b14\u8bb0"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/16866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=16866"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/16866\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=16866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=16866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=16866"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=16866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}