{"id":43384,"date":"2023-09-30T23:19:08","date_gmt":"2023-09-30T15:19:08","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=43384"},"modified":"2023-09-30T23:19:08","modified_gmt":"2023-09-30T15:19:08","slug":"tywdqb","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/43384.html","title":{"rendered":"TCP\u4e0eWebsocket\u7684\u533a\u522b"},"content":{"rendered":"
\u5728\u4e92\u8054\u7f51\u7684\u5e94\u7528\u4e2d\uff0cTCP\u548cWebsocket\u662f\u4e24\u79cd\u5e38\u89c1\u7684\u4f20\u8f93\u534f\u8bae\u3002\u5b83\u4eec\u4e4b\u95f4\u6709\u5f88\u591a\u4e0d\u540c\u4e4b\u5904\uff0c\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8\u5b83\u4eec\u7684\u533a\u522b\u3002<\/p>\n
TCP\uff08\u4f20\u8f93\u63a7\u5236\u534f\u8bae\uff09\u662f\u4e00\u79cd\u9762\u5411\u8fde\u63a5\u7684\u4f20\u8f93\u534f\u8bae\uff0c\u5b83\u53ef\u4ee5\u786e\u4fdd\u53d1\u9001\u7684\u6570\u636e\u6309\u7167\u9884\u5b9a\u987a\u5e8f\u62b5\u8fbe\u76ee\u6807\u5730\u5740\u3002\u5b83\u4f7f\u7528\u4e09\u6b21\u63e1\u624b\u786e\u4fdd\u53cc\u65b9\u7684\u8fde\u63a5\uff0c\u5e76\u4e14\u5728\u6570\u636e\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u53d1\u73b0\u4f20\u8f93\u4e2d\u65ad\u7684\u60c5\u51b5\uff0c\u7136\u540e\u91cd\u65b0\u53d1\u9001\u4f20\u8f93\u3002<\/p>\n
Websocket\u662f\u4e00\u79cd\u57fa\u4e8eTCP\u7684\u534f\u8bae\uff0c\u5b83\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5efa\u7acb\u53cc\u5411\u901a\u4fe1\u7684\u8fde\u63a5\u3002\u5b83\u4f7f\u7528HTTP\u534f\u8bae\u7684Upgrade\u673a\u5236\uff0c\u53ef\u4ee5\u5728\u5efa\u7acb\u8fde\u63a5\u540e\u4e0d\u65ad\u5730\u53d1\u9001\u6570\u636e\uff0c\u800c\u4e0d\u9700\u8981\u5ba2\u6237\u7aef\u91cd\u65b0\u53d1\u8d77\u8bf7\u6c42\u3002<\/p>\n
\u4ece\u4e0a\u9762\u7684\u5206\u6790\u53ef\u4ee5\u770b\u51fa\uff0cTCP\u548cWebsocket\u662f\u4e24\u79cd\u4e0d\u540c\u7684\u4f20\u8f93\u534f\u8bae\uff0c\u5b83\u4eec\u5404\u6709\u4f18\u7f3a\u70b9\u3002<\/strong>TCP\u662f\u4e00\u79cd\u53ef\u9760\u7684\u4f20\u8f93\u534f\u8bae\uff0c\u53ef\u4ee5\u786e\u4fdd\u53d1\u9001\u7684\u6570\u636e\u51c6\u786e\u65e0\u8bef\u7684\u62b5\u8fbe\u76ee\u6807\u5730\u5740\uff0c\u4f46\u662f\u5b83\u7684\u5efa\u7acb\u8fde\u63a5\u65f6\u95f4\u6bd4\u8f83\u957f\uff0c\u6570\u636e\u4f20\u8f93\u901f\u5ea6\u6bd4\u8f83\u6162\uff0c\u4e5f\u4e0d\u80fd\u5904\u7406\u5b9e\u65f6\u6570\u636e\u3002Websocket\u662f\u4e00\u79cd\u57fa\u4e8eTCP\u7684\u534f\u8bae\uff0c\u5b83\u53ef\u4ee5\u5728\u5efa\u7acb\u8fde\u63a5\u540e\u4e0d\u65ad\u5730\u53d1\u9001\u6570\u636e\uff0c\u800c\u4e0d\u9700\u8981\u5ba2\u6237\u7aef\u91cd\u65b0\u53d1\u8d77\u8bf7\u6c42\uff0c\u4f46\u662f\u5b83\u4e0d\u80fd\u786e\u4fdd\u53d1\u9001\u7684\u6570\u636e\u51c6\u786e\u65e0\u8bef\u7684\u62b5\u8fbe\u76ee\u6807\u5730\u5740\uff0c\u4e5f\u5bb9\u6613\u5f15\u8d77\u7f51\u7edc\u62e5\u585e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u5728\u4e92\u8054\u7f51\u7684\u5e94\u7528\u4e2d\uff0cTCP\u548cWebsocket\u662f\u4e24\u79cd\u5e38\u89c1\u7684\u4f20\u8f93\u534f\u8bae\u3002\u5b83\u4eec\u4e4b\u95f4\u6709\u5f88\u591a\u4e0d\u540c\u4e4b\u5904\uff0c\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8\u5b83\u4eec\u7684\u533a\u522b\u3002TCPTCP\uff08\u4f20\u8f93\u63a7\u5236\u534f\u8bae\uff09\u662f\u4e00\u79cd<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","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":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[161],"class_list":["post-43384","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-tcp"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/43384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=43384"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/43384\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=43384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=43384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=43384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}