{"id":101409,"date":"2026-09-06T20:17:15","date_gmt":"2026-09-06T12:17:15","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/101409.html"},"modified":"2026-09-06T20:17:15","modified_gmt":"2026-09-06T12:17:15","slug":"linux%e7%bd%91%e7%bb%9c%ef%bc%88%e5%85%ad%ef%bc%89%ef%bc%9a%e4%b8%80%e6%96%87%e5%90%83%e9%80%8f-tcp-socket-%e7%bc%96%e7%a8%8b%ef%bc%9a%e4%bb%8e%e7%9b%91%e5%90%ac%e7%8a%b6%e6%80%81%e5%88%b0-accept","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/101409.html","title":{"rendered":"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260906121712-6a9d59c83f9d5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"200\" \/><\/p>\n<p> <b> \u25c6 \u535a\u4e3b\u540d\u79f0&#xff1a; \u5c0f\u6b64\u65b9-CSDN\u535a\u5ba2 <\/b> <\/p>\n<p>   \u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230\u5c0f\u6b64\u65b9\u7684\u535a\u5ba2\u3002 <\/p>\n<p>    \u2b50\ufe0f\u7f51\u7edc\u7cfb\u5217\u4e2a\u4eba\u4e13\u680f&#xff1a;<br \/>\n    \u3010\u4e3b\u9898\u66f2\u3011\u8ba1\u7b97\u673a\u7f51\u7edc  <\/p>\n<p>  \u2b50\ufe0f\u6b64\u65b9\u7684GitHub&#xff1a;<br \/>\n  github_\u6b64\u65b9  <\/p>\n<p>  \u2b50\ufe0f<br \/>\n <b>\u6211\u4eec\u601d\u8003 (Rethink) \u00b7 \u6211\u4eec\u91cd\u5efa (Rebuild) \u00b7 \u6211\u4eec\u8bb0\u5f55 (Record) <\/b> <\/p>\n<hr \/>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\u6982\u8981&amp;\u5e8f\u8ad6<\/li>\n<li>\u4e00\u3001TCP \u5957\u63a5\u5b57 API \u8be6\u89e3<\/li>\n<li>\n<ul>\n<li>1.1 socket \u51fd\u6570<\/li>\n<li>1.2 bind \u51fd\u6570<\/li>\n<li>1.3 listen \u51fd\u6570\u4e0e\u76d1\u542c\u72b6\u6001&#xff08;\u91cd\u70b9\u8bb2&#xff0c;UDP\u6ca1\u6709&#xff09;<\/li>\n<li>\n<ul>\n<li>1.3.1 listen \u51fd\u6570\u89e3\u6790<\/li>\n<li>1.3.2 \u67e5\u770b\u7f51\u7edc\u8fdb\u7a0b\u76d1\u542c\u72b6\u6001<\/li>\n<li>1.3.3 \u8fde\u63a5\u5efa\u7acb\u4e0e\u72b6\u6001\u8f6c\u6362<\/li>\n<\/ul>\n<\/li>\n<li>1.4 accept \u51fd\u6570\u4e0e\u5957\u63a5\u5b57\u7684\u5206\u5de5<\/li>\n<li>\n<ul>\n<li>1.4.1 \u201c\u597d\u518d\u6765\u9c7c\u5e84\u201d\u7684\u6545\u4e8b<\/li>\n<li>1.4.2 accept \u51fd\u6570\u8be6\u89e3<\/li>\n<li>1.4.3 \u6570\u636e\u8bfb\u53d6\u5199\u5165<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001\u9644\u4e0a\u6e90\u7801<\/li>\n<\/ul>\n<hr \/>\n<h2>\u6982\u8981&amp;\u5e8f\u8ad6<\/h2>\n<p>\u2003\u2003Hello\u5927\u5bb6\u597d&#xff0c;\u6211\u662f\u6b64\u65b9&#xff0c;\u4e0a\u4e00\u671f\u6211\u4eec\u8bb2\u89e3\u4e86UDP\u5957\u63a5\u5b57\u7f16\u7a0b\u7684\u8be6\u7ec6\u65b9\u6cd5&#xff0c;\u672c\u6587\u662f Linux \u7f51\u7edc\u7f16\u7a0b\u7cfb\u5217\u7684\u7b2c\u516d\u7bc7&#xff0c;\u91cd\u70b9\u5256\u6790\u9762\u5411\u8fde\u63a5\u7684 TCP \u5957\u63a5\u5b57\u7f16\u7a0b\u57fa\u7840\u4e0e\u6838\u5fc3 API\u3002 \u2003\u2003\u6587\u7ae0\u9996\u5148\u68b3\u7406 TCP \u5957\u63a5\u5b57\u521b\u5efa\u4e0e\u5730\u5740\u7ed1\u5b9a\u7684\u57fa\u7840\u6d41\u7a0b&#xff0c;\u6df1\u5165\u89e3\u6790 socket() \u4e0e bind() \u7684\u53c2\u6570\u542b\u4e49\u53ca\u521d\u59cb\u5316\u89c4\u8303&#xff1b;\u63a5\u7740\u91cd\u70b9\u5bf9\u6bd4 UDP&#xff0c;\u8be6\u7ec6\u8bb2\u89e3 TCP \u72ec\u6709\u7684 listen() \u51fd\u6570\u3001\u76d1\u542c\u72b6\u6001\u673a\u5236&#xff08;LISTEN&#xff09;\u4ee5\u53ca\u4f7f\u7528 netstat \u7b49\u5de5\u5177\u67e5\u770b\u7f51\u7edc\u8fde\u63a5\u72b6\u6001\u7684\u65b9\u6cd5&#xff1b;\u6700\u540e\u901a\u8fc7\u901a\u4fd7\u6613\u61c2\u7684\u201c\u9c7c\u5e84\u62c9\u5ba2\u201d\u751f\u6d3b\u7c7b\u6bd4&#xff0c;\u6df1\u5ea6\u62c6\u89e3 accept() \u51fd\u6570\u7684\u5de5\u4f5c\u539f\u7406&#xff0c;\u5398\u6e05\u201c\u76d1\u542c\u5957\u63a5\u5b57\u201d\u4e0e\u201c\u670d\u52a1\u5957\u63a5\u5b57\u201d\u7684\u5206\u5de5\u533a\u522b&#xff0c;\u5e76\u5206\u6790\u5355\u8fdb\u7a0b TCP \u670d\u52a1\u5668\u6a21\u578b\u7684\u74f6\u9888\u6240\u5728\u3002\u597d\u7684\u6211\u4eec\u5f00\u59cb\u5427\u3002<\/p>\n<h2>\u4e00\u3001TCP \u5957\u63a5\u5b57 API \u8be6\u89e3<\/h2>\n<p>\u2003\u2003\u5728\u8fdb\u884c TCP \u7f51\u7edc\u7f16\u7a0b\u65f6&#xff0c;\u9996\u5148\u9700\u8981\u4e86\u89e3 Linux \u7cfb\u7edf\u63d0\u4f9b\u7684\u6807\u51c6\u5957\u63a5\u5b57\u63a5\u53e3&#xff08;\u5b9a\u4e49\u5728 sys\/socket.h \u5934\u6587\u4ef6\u4e2d&#xff09;\u3002\u4e0e\u65e0\u8fde\u63a5\u7684 UDP \u7f16\u7a0b\u7c7b\u4f3c&#xff0c;TCP \u901a\u4fe1\u7684\u7b2c\u4e00\u6b65\u4e5f\u662f\u901a\u8fc7\u521b\u5efa\u5957\u63a5\u5b57\u6765\u5efa\u7acb\u901a\u4fe1\u7aef\u70b9\u3002<\/p>\n<h3>1.1 socket \u51fd\u6570<\/h3>\n<p>\u2003\u2003socket() \u51fd\u6570\u7528\u4e8e\u6253\u5f00\u4e00\u4e2a\u7f51\u7edc\u901a\u8baf\u7aef\u53e3\u3002\u5982\u679c\u8c03\u7528\u6210\u529f&#xff0c;\u5b83\u4f1a\u50cf open() \u7cfb\u7edf\u8c03\u7528\u4e00\u6837&#xff0c;\u8fd4\u56de\u4e00\u4e2a\u5957\u63a5\u5b57\u6587\u4ef6\u63cf\u8ff0\u7b26&#xff08;Socket Descriptor&#xff09;&#xff0c;\u540e\u7eed\u7684\u7f51\u7edc\u8bfb\u5199\u64cd\u4f5c\u90fd\u53ef\u4ee5\u56f4\u7ed5\u8be5\u63cf\u8ff0\u7b26\u5c55\u5f00\u3002<\/p>\n<p>\u51fd\u6570\u58f0\u660e&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;sys\/types.h&gt;<\/span>          <span class=\"token comment\">\/* See NOTES *\/<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;sys\/socket.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">socket<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> domain<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> type<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> protocol<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u53c2\u6570\u4e0e\u8fd4\u56de\u503c\u8be6\u7ec6\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li><font color=\"red\">\u548cUDP\u552f\u4e00\u533a\u522b&#xff1a;type&#xff08;\u5957\u63a5\u5b57\u7c7b\u578b&#xff09;&#xff1a; \u6307\u5b9a\u6570\u636e\u4f20\u8f93\u7684\u670d\u52a1\u7c7b\u578b\u3002\u5bf9\u4e8e TCP \u534f\u8bae&#xff0c;\u8be5\u53c2\u6570\u5fc5\u987b\u6307\u5b9a\u4e3a SOCK_STREAM&#xff0c;\u8868\u793a\u9762\u5411\u8fde\u63a5\u7684\u3001\u53ef\u9760\u7684\u5b57\u8282\u6d41\u4f20\u8f93\u534f\u8bae\u3002<\/font><\/li>\n<\/ul>\n<h3>1.2 bind \u51fd\u6570<\/h3>\n<p>\u2003\u2003\u4e0d\u8bb2&#xff0c;\u548c\u4e0a\u4e00\u671f\u8bb2\u7684UDP\u5b8c\u5168\u4e00\u81f4<\/p>\n<h3>1.3 listen \u51fd\u6570\u4e0e\u76d1\u542c\u72b6\u6001&#xff08;\u91cd\u70b9\u8bb2&#xff0c;UDP\u6ca1\u6709&#xff09;<\/h3>\n<p>\u2003\u2003\u4e0d\u540c\u4e8e UDP \u7684\u65e0\u8fde\u63a5\u7279\u6027&#xff0c;TCP \u662f\u9762\u5411\u8fde\u63a5\u7684\u4f20\u8f93\u5c42\u534f\u8bae\u3002 \u2003\u2003\u53bb\u9910\u9986\u5403\u996d&#xff0c;\u8001\u677f\u4e00\u5b9a\u5728\u5b88\u8fd9\u4e2a\u5e97\u3002\u968f\u65f6\u7b49\u5f85\u5ba2\u6237\u7684\u5230\u6765&#xff0c;\u4e00\u76f4\u7b49\u5f85\u3002\u2014\u2014\u8fd9\u5c31\u662f\u76d1\u542c\u3002 \u2003\u2003\u6211\u7ed9\u4f60\u53d1\u90ae\u4ef6&#xff0c;\u4f60\u4e0d\u7528\u4e00\u76f4\u5728\u7b49\u5f85\u2014\u2014\u8fd9\u5c31\u662f\u9762\u5411\u6570\u636e\u62a5<\/p>\n<p>\u2003\u2003TCP\u662f\u9762\u5411\u8fde\u63a5\u7684\u3002\u4ed6\u9700\u8981\u5904\u4e8e\u76d1\u542c\u72b6\u6001\u7b49\u5f85\u4f60\u53bb\u8fde\u63a5\u3002<\/p>\n<h4>1.3.1 listen \u51fd\u6570\u89e3\u6790<\/h4>\n<p>\u2003\u2003listen() \u51fd\u6570\u58f0\u660e sockfd \u5904\u4e8e\u76d1\u542c\u72b6\u6001\u3002\u5f53\u6709\u591a\u4e2a\u5ba2\u6237\u7aef\u540c\u65f6\u53d1\u8d77\u8fde\u63a5\u8bf7\u6c42\u65f6&#xff0c;\u8fd9\u4e9b\u8fde\u63a5\u8bf7\u6c42\u9700\u8981\u6392\u961f\u7b49\u5f85\u5904\u7406\u3002listen() \u51b3\u5b9a\u4e86\u6700\u591a\u5141\u8bb8\u6709\u591a\u5c11\u4e2a\u5ba2\u6237\u7aef\u5904\u4e8e\u8fde\u63a5\u7b49\u5f85\u961f\u5217&#xff08;\u5168\u8fde\u63a5\u961f\u5217&#xff09;\u4e2d\u3002 \u2003\u2003\u51fd\u6570\u7b7e\u540d&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;sys\/types.h&gt;<\/span>          <span class=\"token comment\">\/* See NOTES *\/<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;sys\/socket.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">listen<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> sockfd<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> backlog<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u53c2\u6570\u4e0e\u8fd4\u56de\u503c\u89e3\u6790&#xff1a;<\/p>\n<ul>\n<li>sockfd&#xff1a; \u5df2\u7ecf\u7ed1\u5b9a&#xff08;bind&#xff09;\u4e86\u5730\u5740\u548c\u7aef\u53e3\u53f7\u7684\u5957\u63a5\u5b57\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002<\/li>\n<li>backlog&#xff1a; \u6307\u5b9a\u63d0\u793a\u961f\u5217\u7684\u6700\u5927\u6392\u961f\u8fde\u63a5\u6570\u3002\u5373\u6700\u591a\u5141\u8bb8\u6709 backlog \u4e2a\u5ba2\u6237\u7aef\u5904\u4e8e\u8fde\u63a5\u7b49\u5f85\u72b6\u6001&#xff1b;\u5982\u679c\u6536\u5230\u66f4\u591a\u7684\u8fde\u63a5\u8bf7\u6c42\u5219\u4f1a\u76f4\u63a5\u5ffd\u7565\u3002\u8be5\u503c\u901a\u5e38\u4e0d\u4f1a\u8bbe\u7f6e\u5f97\u592a\u5927&#xff08;\u901a\u5e38\u8bbe\u7f6e\u4e3a 5 \u6216 128 \u7b49&#xff09;\u3002<\/li>\n<li>\u8fd4\u56de\u503c&#xff1a; \u6210\u529f\u8fd4\u56de 0&#xff0c;\u5931\u8d25\u8fd4\u56de -1\u3002<\/li>\n<\/ul>\n<h4>1.3.2 \u67e5\u770b\u7f51\u7edc\u8fdb\u7a0b\u76d1\u542c\u72b6\u6001<\/h4>\n<p>\u2003\u2003\u53ea\u8981 TCP \u670d\u52a1\u5668\u8c03\u7528 listen() \u6210\u529f\u5e76\u8fdb\u5165 LISTEN \u72b6\u6001&#xff0c;\u5b83\u5c31\u5df2\u7ecf\u5177\u5907\u4e86\u63a5\u53d7\u5ba2\u6237\u7aef\u8fde\u63a5\u7684\u80fd\u529b\u3002 \u2003\u2003\u53ef\u4ee5\u901a\u8fc7 Linux \u7cfb\u7edf\u547d\u4ee4\u884c\u5de5\u5177\u68c0\u67e5\u7f51\u7edc\u5957\u63a5\u5b57\u7684\u72b6\u6001&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u6240\u6709 TCP \u548c UDP \u76d1\u542c\u53ca\u8fde\u63a5\u72b6\u6001&#xff08;\u663e\u793a PID \u53ca\u7a0b\u5e8f\u540d&#xff09;<\/span><br \/>\n<span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-tnap<\/span><\/p>\n<p><span class=\"token comment\"># \u4ec5\u67e5\u770b\u5904\u4e8e LISTEN \u72b6\u6001\u7684\u5957\u63a5\u5b57<\/span><br \/>\n<span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-tnlp<\/span><\/p>\n<p>\u5e38\u7528\u53c2\u6570\u542b\u4e49&#xff1a;<\/p>\n<ul>\n<li>-t (tcp)&#xff1a; \u4ec5\u663e\u793a TCP \u76f8\u5173\u7684\u5957\u63a5\u5b57\u3002<\/li>\n<li>-u (udp)&#xff1a; \u4ec5\u663e\u793a UDP \u76f8\u5173\u7684\u5957\u63a5\u5b57\u3002<\/li>\n<li>-n (numeric)&#xff1a; \u76f4\u63a5\u663e\u793a\u6570\u5b57\u5f62\u5f0f\u7684 IP \u5730\u5740\u548c\u7aef\u53e3\u53f7&#xff0c;\u4e0d\u8fdb\u884c\u57df\u540d\u4e0e\u670d\u52a1\u540d\u89e3\u6790\u3002<\/li>\n<li>-l (listening)&#xff1a; \u4ec5\u663e\u793a\u5904\u4e8e LISTEN&#xff08;\u76d1\u542c&#xff09;\u72b6\u6001\u7684\u5957\u63a5\u5b57\u3002<\/li>\n<li>-p (programs)&#xff1a; \u663e\u793a\u8fdb\u7a0b\u540d\u79f0\u3002<\/li>\n<\/ul>\n<h4>1.3.3 \u8fde\u63a5\u5efa\u7acb\u4e0e\u72b6\u6001\u8f6c\u6362<\/h4>\n<p>\u2003\u2003\u4ee5\u4f7f\u7528 telnet \u5de5\u5177\u5411\u670d\u52a1\u5668\u53d1\u8d77\u8fde\u63a5\u4e3a\u4f8b&#xff1a;<\/p>\n<li>\n<p>\u672a\u8fde\u63a5\u524d&#xff0c;\u670d\u52a1\u5668\u8fdb\u7a0b\u5904\u4e8e LISTEN \u72b6\u6001&#xff1a;<\/p>\n<p> Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID\/Program name<br \/>\ntcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1080682\/.\/tcpserver\n <\/li>\n<li>\n<p>\u5ba2\u6237\u7aef\u6267\u884c telnet 127.0.0.1 8080 \u5efa\u7acb\u8fde\u63a5\u540e&#xff0c;\u7f51\u7edc\u72b6\u6001\u4e2d\u4f1a\u65b0\u589e\u5bf9\u5e94\u7684 ESTABLISHED \u72b6\u6001\u8bb0\u5f55&#xff08;\u8868\u793a\u8fde\u63a5\u5df2\u6210\u529f\u5efa\u7acb&#xff09;&#xff1a;<\/p>\n<p> Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID\/Program name<br \/>\ntcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1080682\/.\/tcpserver<br \/>\ntcp        0      0 127.0.0.1:58752         127.0.0.1:8080          ESTABLISHED 1080746\/telnet<br \/>\ntcp        0      0 127.0.0.1:8080          127.0.0.1:58752         ESTABLISHED &#8211;\n <\/li>\n<p>\u2003\u2003\u5728\u540c\u53f0\u4e3b\u673a\u6d4b\u8bd5\u65f6&#xff0c;netstat \u8f93\u51fa\u4e2d\u4f1a\u51fa\u73b0\u4e24\u6761 ESTABLISHED \u8bb0\u5f55\u3002\u4ea7\u751f\u8be5\u73b0\u8c61\u7684\u539f\u56e0\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>TCP \u662f\u5168\u53cc\u5de5\u901a\u4fe1&#xff1a; \u901a\u4fe1\u53cc\u65b9\u65e2\u662f\u53d1\u9001\u65b9\u4e5f\u662f\u63a5\u6536\u65b9&#xff0c;\u53cc\u5411\u901a\u9053\u72ec\u7acb\u5b58\u5728\u3002<\/li>\n<li>\u540c\u673a\u6d4b\u8bd5&#xff1a; \u5ba2\u6237\u7aef&#xff08;Client&#xff09;\u4e0e\u670d\u52a1\u5668&#xff08;Server&#xff09;\u90e8\u7f72\u5728\u540c\u4e00\u53f0\u673a\u5668\u4e0a&#xff0c;\u7cfb\u7edf\u5728\u56de\u73af\u7f51\u5361&#xff08;127.0.0.1&#xff09;\u4e0a\u540c\u65f6\u8bb0\u5f55\u4e86\u201c\u5ba2\u6237\u7aef\u7aef\u53e3 -&gt; \u670d\u52a1\u5668\u7aef\u53e3\u201d\u4ee5\u53ca\u201c\u670d\u52a1\u5668\u7aef\u53e3 -&gt; \u5ba2\u6237\u7aef\u7aef\u53e3\u201d\u7684\u4e24\u6761\u5bf9\u79f0\u94fe\u8def\u8fde\u63a5\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<h3>1.4 accept \u51fd\u6570\u4e0e\u5957\u63a5\u5b57\u7684\u5206\u5de5<\/h3>\n<p>\u2003\u2003\u6700\u5bb9\u6613\u8ba9\u4eba\u4ea7\u751f\u56f0\u60d1\u7684\u6982\u5ff5\u83ab\u8fc7\u4e8e accept() \u51fd\u6570\u7684\u8fd4\u56de\u503c\u3002\u4e3a\u4ec0\u4e48\u8c03\u7528 accept() \u4e4b\u540e&#xff0c;\u7cfb\u7edf\u53c8\u8fd4\u56de\u4e86\u4e00\u4e2a\u5168\u65b0\u7684\u5957\u63a5\u5b57\u6587\u4ef6\u63cf\u8ff0\u7b26&#xff1f;\u539f\u6765\u521b\u5efa\u7684\u90a3\u4e2a\u5957\u63a5\u5b57\u53c8\u53bb\u54ea\u4e86&#xff1f;<\/p>\n<h4>1.4.1 \u201c\u597d\u518d\u6765\u9c7c\u5e84\u201d\u7684\u6545\u4e8b<\/h4>\n<p>\u2003\u2003\u5047\u8bbe\u5728\u897f\u6e56\u8fb9\u5f00\u7740\u4e00\u5bb6\u6781\u5176\u706b\u7206\u7684\u201c\u597d\u518d\u6765\u9c7c\u5e84\u201d&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260906121712-6a9d59c8d5bf5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<ul>\n<li>\u62c9\u5ba2\u5458&#xff08;\u5f20\u4e09&#xff09;&#xff1a; \u7ad9\u5728\u9c7c\u5e84\u95e8\u53e3&#xff08;\u9a6c\u8def\u8fb9&#xff09;&#xff0c;\u4e13\u95e8\u8d1f\u8d23\u70ed\u60c5\u62db\u547c\u8def\u8fc7\u7684\u6e38\u5ba2\u3002\u5f20\u4e09\u7684\u5de5\u4f5c\u975e\u5e38\u7eaf\u7cb9\u2014\u2014\u53ea\u8981\u770b\u5230\u6709\u987e\u5ba2\u60f3\u7528\u9910&#xff0c;\u5c31\u628a\u987e\u5ba2\u5f15\u5bfc\u8fdb\u5e97\u5185&#xff0c;\u4ea4\u7ed9\u5e97\u5185\u7684\u670d\u52a1\u5458\u3002\u5f20\u4e09\u4e0d\u8d1f\u8d23\u5177\u4f53\u7684\u70b9\u83dc\u3001\u7aef\u8336\u6216\u5012\u6c34&#xff0c;\u5f15\u5bfc\u5b8c\u4e00\u4f4d\u5ba2\u4eba\u540e&#xff0c;\u4ed6\u4f1a\u7acb\u523b\u56de\u5230\u95e8\u53e3\u7ee7\u7eed\u62c9\u5ba2\u3002<\/li>\n<li>\u670d\u52a1\u5458&#xff08;\u674e\u56db\u3001\u738b\u4e8c\u9ebb&#xff09;&#xff1a; \u5750\u5728\u5e97\u5185&#xff0c;\u4e13\u95e8\u8d1f\u8d23\u5bf9\u63a5\u5df2\u7ecf\u88ab\u5f20\u4e09\u5e26\u8fdb\u6765\u7684\u987e\u5ba2\u3002\u4ed6\u4eec\u8d1f\u8d23\u70b9\u83dc\u3001\u4e0a\u83dc\u3001\u966a\u804a\u3001\u7ed3\u8d26\u7b49\u5177\u4f53\u7684\u670d\u52a1\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n<p>\u2003\u2003\u5728\u8fd9\u4e2a\u6545\u4e8b\u4e2d&#xff1a;<\/p>\n<li>\u76d1\u542c\u5957\u63a5\u5b57&#xff08;listensockfd&#xff09; \u5c31\u662f\u62c9\u5ba2\u5458\u5f20\u4e09&#xff1a;\u5b83\u552f\u4e00\u7684\u4f7f\u547d\u5c31\u662f\u5728\u7279\u5b9a\u7aef\u53e3\u4e0a\u76d1\u542c\u5916\u90e8\u8bf7\u6c42&#xff0c;\u8d1f\u8d23\u5efa\u7acb\u5e76\u201c\u83b7\u53d6\u201d\u8fde\u63a5&#xff0c;\u800c\u4e0d\u627f\u62c5\u540e\u7eed\u4e0e\u5ba2\u6237\u7aef\u7684\u6570\u636e\u901a\u4fe1&#xff08;I\/O&#xff09;\u3002<\/li>\n<li>\u670d\u52a1\u5957\u63a5\u5b57&#xff08;accept() \u8fd4\u56de\u7684 sockfd&#xff09; \u5c31\u662f\u670d\u52a1\u5458&#xff08;\u5982\u674e\u56db&#xff09;&#xff1a;\u5f53\u8fde\u63a5\u5efa\u7acb\u540e&#xff0c;\u7cfb\u7edf\u4e13\u95e8\u5206\u914d\u8be5\u5957\u63a5\u5b57\u6765\u4e0e\u8be5\u5177\u4f53\u7684\u5ba2\u6237\u7aef\u8fdb\u884c read\/write \u6570\u636e\u4ea4\u4e92\u3002<\/li>\n<h4>1.4.2 accept \u51fd\u6570\u8be6\u89e3<\/h4>\n<p>\u2003\u2003\u9700\u8981\u7279\u522b\u660e\u786e\u7684\u662f&#xff1a;TCP \u4e09\u6b21\u63e1\u624b\u5efa\u7acb\u8fde\u63a5\u7684\u8fc7\u7a0b\u5b8c\u5168\u7531\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u81ea\u52a8\u5b8c\u6210&#xff0c;\u4e0e\u662f\u5426\u8c03\u7528 accept() \u65e0\u5173\u3002 accept() \u7684\u672c\u8d28\u4f5c\u7528\u662f\u4ece\u5185\u6838\u7684\u5df2\u5b8c\u6210\u8fde\u63a5\u961f\u5217\u4e2d\u83b7\u53d6\u4e00\u4e2a\u5df2\u7ecf\u5efa\u7acb\u597d\u7684\u8fde\u63a5\u3002 \u2003\u2003\u51fd\u6570\u7b7e\u540d&#xff1a;<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;sys\/types.h&gt;<\/span>          <span class=\"token comment\">\/* See NOTES *\/<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;sys\/socket.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">accept<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> sockfd<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">sockaddr<\/span> <span class=\"token operator\">*<\/span>addr<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">socklen_t<\/span> <span class=\"token operator\">*<\/span>addrlen<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u53c2\u6570\u4e0e\u8fd4\u56de\u503c\u89e3\u6790&#xff1a;<\/p>\n<ul>\n<li>sockfd&#xff1a; \u76d1\u542c\u5957\u63a5\u5b57\u63cf\u8ff0\u7b26&#xff08;\u5373 listensockfd&#xff0c;\u76f8\u5f53\u4e8e\u62c9\u5ba2\u5458\u5f20\u4e09&#xff09;&#xff0c;\u5b83\u4e13\u95e8\u8d1f\u8d23\u4f20\u5165 accept() \u7528\u4e8e\u83b7\u53d6\u8fde\u63a5\u3002<\/li>\n<li>addr&#xff1a; \u8f93\u51fa\u578b\u53c2\u6570&#xff0c;\u7528\u4e8e\u83b7\u53d6\u8fde\u63a5\u6210\u529f\u7684\u5ba2\u6237\u7aef\u7f51\u7edc\u5730\u5740\u4fe1\u606f&#xff08;\u5305\u542b\u5ba2\u6237\u7aef\u7684 IP \u548c\u7aef\u53e3\u53f7&#xff09;\u3002<\/li>\n<li>addrlen&#xff1a; \u503c-\u7ed3\u679c\u53c2\u6570&#xff0c;\u4f20\u5165\u65f6\u4e3a addr \u7ed3\u6784\u4f53\u7684\u957f\u5ea6&#xff0c;\u8fd4\u56de\u65f6\u4e3a\u5b9e\u9645\u5199\u5165\u7684\u5730\u5740\u7ed3\u6784\u4f53\u5927\u5c0f\u3002<\/li>\n<li>\u8fd4\u56de\u503c&#xff1a; \u6210\u529f\u65f6\u8fd4\u56de\u4e00\u4e2a\u5168\u65b0\u7684\u5957\u63a5\u5b57\u6587\u4ef6\u63cf\u8ff0\u7b26&#xff08;\u670d\u52a1\u5957\u63a5\u5b57&#xff0c;\u76f8\u5f53\u4e8e\u670d\u52a1\u5458&#xff09;&#xff1b;\u5982\u679c\u83b7\u53d6\u5931\u8d25&#xff0c;\u5219\u8fd4\u56de -1\u3002<\/li>\n<\/ul>\n<p>\u2003\u2003\u540e\u7eed\u9488\u5bf9\u8be5\u5ba2\u6237\u7aef\u7684\u6240\u6709\u6570\u636e\u4f20\u8f93&#xff08;read\/write \u6216 recv\/send&#xff09;&#xff0c;\u5747\u4f7f\u7528 accept() \u8fd4\u56de\u7684\u8fd9\u4e2a\u65b0\u5957\u63a5\u5b57 \u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<h4>1.4.3 \u6570\u636e\u8bfb\u53d6\u5199\u5165<\/h4>\n<p>\u2003\u2003UDP \u662f\u9762\u5411\u6570\u636e\u62a5\u7684&#xff0c;\u5177\u6709\u7279\u5b9a\u7684\u6536\u53d1\u63a5\u53e3&#xff08;\u5982 recvfrom\/sendto&#xff09;&#xff1b;\u800c TCP \u662f\u9762\u5411\u5b57\u8282\u6d41\u7684&#xff0c;\u56e0\u6b64\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u6807\u51c6\u7684 Linux \u6587\u4ef6 I\/O \u7cfb\u7edf\u8c03\u7528 read() \u4e0e write() \u8fdb\u884c\u6570\u636e\u901a\u4fe1\u3002<\/p>\n<h2>\u4e8c\u3001\u9644\u4e0a\u6e90\u7801<\/h2>\n<p>\u2003\u2003\u90fd\u662f\u624b\u5199\u4ee3\u7801&#xff0c;\u53ef\u80fd\u4f1a\u6709bug&#xff0c;\u5982\u679c\u6709&#xff0c;\u975e\u5e38\u6b22\u8fce\u5927\u4f6c\u6307\u51fa\u79c1\u4fe1\u3002\u91cf\u771f\u7684\u592a\u5927\u4e86&#xff0c;\u6211\u628a\u4ed3\u5e93\u8d34\u4e00\u4e0b&#xff1a;&#xff08;\u76ee\u524d\u4ed3\u5e93\u8fd8\u5728\u5efa\u8bbe\u4e2d&#xff0c;Readme\u8fd8\u6ca1\u6709\u5199\u3002&#xff09;Konata\u2019s Network-Programming <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260906121713-6a9d59c9a31fc.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<p> <b>\u597d\u7684\u672c\u671f\u5185\u5bb9\u5c31\u5230\u8fd9\u91cc&#xff0c;\u5982\u679c\u5bf9\u4f60\u6709\u5e2e\u52a9&#xff0c;\u8fd8\u4e0d\u8981\u5fd8\u8bb0\u70b9\u8d5e\u4e09\u8054\u652f\u6301\u3002\u6211\u662f\u6b64\u65b9&#xff0c;\u6211\u4eec\u4e0b\u671f\u518d\u89c1\u3002bye! Linux\u3001C&#043;&#043;\u3001\u7b97\u6cd5\u6301\u7eed\u8fde\u8f7d\u4e2d&#xff0c;\u6b22\u8fce\u5173\u6ce8WeChat Official Account \u3010\u6b64\u65b9\u7684\u6280\u672f\u6808\u3011\u3002<\/b> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u25c6 \u535a\u4e3b\u540d\u79f0&#xff1a; \u5c0f\u6b64\u65b9-CSDN\u535a\u5ba2  \u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230\u5c0f\u6b64\u65b9\u7684\u535a\u5ba2\u3002 \u2b50\ufe0f\u7f51\u7edc\u7cfb\u5217\u4e2a\u4eba\u4e13\u680f&#xff1a; \u3010\u4e3b\u9898\u66f2\u3011\u8ba1\u7b97\u673a\u7f51\u7edc  \u2b50\ufe0f\u6b64\u65b9\u7684GitHub&#xff1a; github_\u6b64\u65b9  \u2b50\ufe0f \u6211\u4eec\u601d\u8003 (Rethink) \u00b7 \u6211\u4eec\u91cd\u5efa (Rebuild) \u00b7 \u6211\u4eec\u8bb0\u5f55 (Record)  \u6587\u7ae0\u76ee\u5f55 \u6982\u8981&amp;\u5e8f\u8ad6\u4e00\u3001TCP \u5957\u63a5\u5b57 API \u8be6\u89e31.1 socket \u51fd\u65701.2 bind \u51fd\u65701.3 listen \u51fd\u6570\u4e0e\u76d1\u542c\u72b6\u6001&#xff08;<\/p>\n","protected":false},"author":2,"featured_media":101406,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,205,78],"topic":[],"class_list":["post-101409","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-tcp-ip","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b - \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\/101409.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u25c6 \u535a\u4e3b\u540d\u79f0&#xff1a; \u5c0f\u6b64\u65b9-CSDN\u535a\u5ba2 \u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230\u5c0f\u6b64\u65b9\u7684\u535a\u5ba2\u3002 \u2b50\ufe0f\u7f51\u7edc\u7cfb\u5217\u4e2a\u4eba\u4e13\u680f&#xff1a; \u3010\u4e3b\u9898\u66f2\u3011\u8ba1\u7b97\u673a\u7f51\u7edc \u2b50\ufe0f\u6b64\u65b9\u7684GitHub&#xff1a; github_\u6b64\u65b9 \u2b50\ufe0f \u6211\u4eec\u601d\u8003 (Rethink) \u00b7 \u6211\u4eec\u91cd\u5efa (Rebuild) \u00b7 \u6211\u4eec\u8bb0\u5f55 (Record) \u6587\u7ae0\u76ee\u5f55 \u6982\u8981&amp;\u5e8f\u8ad6\u4e00\u3001TCP \u5957\u63a5\u5b57 API \u8be6\u89e31.1 socket \u51fd\u65701.2 bind \u51fd\u65701.3 listen \u51fd\u6570\u4e0e\u76d1\u542c\u72b6\u6001&#xff08;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/101409.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-06T12:17:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260906121712-6a9d59c83f9d5.png\" \/>\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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101409.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/101409.html\",\"name\":\"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-06T12:17:15+00:00\",\"dateModified\":\"2026-09-06T12:17:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/101409.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/101409.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101409.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b\"}]},{\"@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":"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b - \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\/101409.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u25c6 \u535a\u4e3b\u540d\u79f0&#xff1a; \u5c0f\u6b64\u65b9-CSDN\u535a\u5ba2 \u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230\u5c0f\u6b64\u65b9\u7684\u535a\u5ba2\u3002 \u2b50\ufe0f\u7f51\u7edc\u7cfb\u5217\u4e2a\u4eba\u4e13\u680f&#xff1a; \u3010\u4e3b\u9898\u66f2\u3011\u8ba1\u7b97\u673a\u7f51\u7edc \u2b50\ufe0f\u6b64\u65b9\u7684GitHub&#xff1a; github_\u6b64\u65b9 \u2b50\ufe0f \u6211\u4eec\u601d\u8003 (Rethink) \u00b7 \u6211\u4eec\u91cd\u5efa (Rebuild) \u00b7 \u6211\u4eec\u8bb0\u5f55 (Record) \u6587\u7ae0\u76ee\u5f55 \u6982\u8981&amp;\u5e8f\u8ad6\u4e00\u3001TCP \u5957\u63a5\u5b57 API \u8be6\u89e31.1 socket \u51fd\u65701.2 bind \u51fd\u65701.3 listen \u51fd\u6570\u4e0e\u76d1\u542c\u72b6\u6001&#xff08;","og_url":"https:\/\/www.wsisp.com\/helps\/101409.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-06T12:17:15+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260906121712-6a9d59c83f9d5.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/101409.html","url":"https:\/\/www.wsisp.com\/helps\/101409.html","name":"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-06T12:17:15+00:00","dateModified":"2026-09-06T12:17:15+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/101409.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/101409.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/101409.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u7f51\u7edc\uff08\u516d\uff09\uff1a\u4e00\u6587\u5403\u900f TCP Socket \u7f16\u7a0b\uff1a\u4ece\u76d1\u542c\u72b6\u6001\u5230 accept \u63e1\u624b\u5168\u6d41\u7a0b"}]},{"@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\/101409","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=101409"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/101409\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/101406"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=101409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=101409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=101409"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=101409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}