{"id":21147,"date":"2023-09-28T22:25:01","date_gmt":"2023-09-28T14:25:01","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=21147"},"modified":"2023-09-28T22:25:01","modified_gmt":"2023-09-28T14:25:01","slug":"mlzbtdxy","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/21147.html","title":{"rendered":"MQTTvsTCP\uff1a\u4e24\u79cd\u4e0d\u540c\u7684\u534f\u8bae"},"content":{"rendered":"

  MQTT\u548cTCP\u662f\u4e24\u79cd\u4e0d\u540c\u7684\u534f\u8bae\uff0c\u5b83\u4eec\u5728\u5e94\u7528\u573a\u666f\u548c\u7279\u6027\u4e0a\u6709\u7740\u660e\u663e\u7684\u5dee\u5f02\u3002\u672c\u6587\u5c06\u6bd4\u8f83MQTT\u548cTCP\u7684\u4f18\u7f3a\u70b9\uff0c\u4ee5\u4fbf\u60a8\u80fd\u591f\u66f4\u597d\u5730\u7406\u89e3\u8fd9\u4e24\u79cd\u534f\u8bae\uff0c\u5e76\u51b3\u5b9a\u54ea\u79cd\u534f\u8bae\u66f4\u9002\u5408\u60a8\u7684\u5e94\u7528\u573a\u666f\u3002<\/p>\n

MQTT\u4ecb\u7ecd<\/h2>\n

  MQTT\uff08\u6d88\u606f\u961f\u5217\u9065\u6d4b\u4f20\u8f93\uff09\u662f\u4e00\u79cd\u57fa\u4e8e\u53d1\u5e03\/\u8ba2\u9605\u6a21\u578b\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae\uff0c\u7528\u4e8e\u8fde\u63a5\u7269\u8054\u7f51\u8bbe\u5907\uff0c\u66f4\u52a0\u8f7b\u91cf\u7ea7\uff0c\u66f4\u52a0\u53ef\u9760\u548c\u5b89\u5168\u3002MQTT\u534f\u8bae\u4f7f\u7528\u8f83\u5c11\u7684\u5e26\u5bbd\uff0c\u8282\u7701\u4e86\u7f51\u7edc\u8d44\u6e90\uff0c\u5e76\u4e14\u652f\u6301\u4f4e\u529f\u8017\u548c\u4f4e\u5ef6\u8fdf\u7684\u8fde\u63a5\u3002MQTT\u534f\u8bae\u53ef\u4ee5\u5728\u4efb\u4f55\u7f51\u7edc\u8fde\u63a5\u4e0a\u8fd0\u884c\uff0c\u5305\u62ec3G\u30014G\u3001Wi-Fi\u7b49\u3002<\/p>\n

TCP\u4ecb\u7ecd<\/h2>\n

  TCP\uff08\u4f20\u8f93\u63a7\u5236\u534f\u8bae\uff09\u662f\u4e00\u79cd\u9762\u5411\u8fde\u63a5\u7684\u534f\u8bae\uff0c\u5b83\u63d0\u4f9b\u53ef\u9760\u7684\u5b57\u8282\u6d41\u670d\u52a1\uff0c\u53ef\u4ee5\u786e\u4fdd\u6570\u636e\u5728\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u6ca1\u6709\u4e22\u5931\u6216\u635f\u574f\u3002TCP\u534f\u8bae\u4f7f\u7528\u4e09\u6b21\u63e1\u624b\u6765\u786e\u4fdd\u8fde\u63a5\u7684\u5b89\u5168\u6027\uff0c\u5e76\u4e14\u53ef\u4ee5\u81ea\u52a8\u91cd\u65b0\u53d1\u9001\u4e22\u5931\u7684\u6570\u636e\u5305\u3002TCP\u534f\u8bae\u53ef\u4ee5\u63d0\u4f9b\u53ef\u9760\u7684\u6570\u636e\u4f20\u8f93\uff0c\u4f46\u662f\u4f1a\u6d88\u8017\u66f4\u591a\u7684\u7f51\u7edc\u8d44\u6e90\uff0c\u56e0\u6b64\u901f\u5ea6\u4f1a\u6bd4\u8f83\u6162\u3002<\/p>\n

MQTT vs TCP\uff1a\u5bf9\u6bd4\u5206\u6790<\/h2>\n

\u8d44\u6e90\u6d88\u8017<\/h3>\n

  MQTT\u534f\u8bae\u975e\u5e38\u8f7b\u91cf\u7ea7\uff0c\u53ef\u4ee5\u8282\u7701\u5927\u91cf\u7684\u7f51\u7edc\u8d44\u6e90\uff0c\u800cTCP\u534f\u8bae\u9700\u8981\u66f4\u591a\u7684\u5e26\u5bbd\uff0c\u6d88\u8017\u7684\u7f51\u7edc\u8d44\u6e90\u66f4\u591a\u3002<\/p>\n

\u8fde\u63a5\u7a33\u5b9a\u6027<\/h3>\n

  MQTT\u534f\u8bae\u53ef\u4ee5\u63d0\u4f9b\u66f4\u7a33\u5b9a\u7684\u8fde\u63a5\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u81ea\u52a8\u91cd\u8fde\u65ad\u5f00\u7684\u8fde\u63a5\uff0c\u800cTCP\u534f\u8bae\u5728\u8fde\u63a5\u65ad\u5f00\u540e\u9700\u8981\u91cd\u65b0\u5efa\u7acb\u8fde\u63a5\uff0c\u56e0\u6b64\u4e0d\u592a\u7a33\u5b9a\u3002<\/p>\n

\u5b89\u5168\u6027<\/h3>\n

  MQTT\u534f\u8bae\u652f\u6301\u5b89\u5168\u4f20\u8f93\uff0c\u53ef\u4ee5\u4f7f\u7528SSL\/TLS\u52a0\u5bc6\u6765\u4fdd\u62a4\u6570\u636e\uff0c\u800cTCP\u534f\u8bae\u53ea\u80fd\u4f7f\u7528IP\u5730\u5740\u548c\u7aef\u53e3\u53f7\u6765\u9650\u5236\u8bbf\u95ee\uff0c\u56e0\u6b64\u5b89\u5168\u6027\u8f83\u4f4e\u3002<\/p>\n

\u901f\u5ea6<\/h3>\n

  MQTT\u534f\u8bae\u53ef\u4ee5\u63d0\u4f9b\u66f4\u5feb\u7684\u901f\u5ea6\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u8282\u7701\u5927\u91cf\u7684\u7f51\u7edc\u8d44\u6e90\uff0c\u800cTCP\u534f\u8bae\u9700\u8981\u66f4\u591a\u7684\u5e26\u5bbd\uff0c\u56e0\u6b64\u4f1a\u6bd4\u8f83\u6162\u3002<\/p>\n

\u5e94\u7528\u573a\u666f<\/h3>\n

  MQTT\u534f\u8bae\u9002\u7528\u4e8e\u4f4e\u529f\u8017\u3001\u4f4e\u5ef6\u8fdf\u7684\u5e94\u7528\u573a\u666f\uff0c\u4f8b\u5982\u7269\u8054\u7f51\u3001\u667a\u80fd\u5bb6\u5c45\u7b49\uff0c\u800cTCP\u534f\u8bae\u9002\u7528\u4e8e\u9700\u8981\u53ef\u9760\u7684\u4f20\u8f93\u7684\u5e94\u7528\u573a\u666f\uff0c\u4f8b\u5982\u6587\u4ef6\u4f20\u8f93\u7b49\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u4ece\u4e0a\u9762\u7684\u5bf9\u6bd4\u5206\u6790\u53ef\u4ee5\u770b\u51fa\uff0cMQTT\u548cTCP\u662f\u4e24\u79cd\u4e0d\u540c\u7684\u534f\u8bae\uff0c\u5b83\u4eec\u5728\u5e94\u7528\u573a\u666f\u548c\u7279\u6027\u4e0a\u6709\u7740\u660e\u663e\u7684\u5dee\u5f02\u3002<\/strong>MQTT\u534f\u8bae\u8282\u7701\u7f51\u7edc\u8d44\u6e90\uff0c\u652f\u6301\u4f4e\u529f\u8017\u548c\u4f4e\u5ef6\u8fdf\uff0c\u9002\u7528\u4e8e\u7269\u8054\u7f51\u7b49\u5e94\u7528\u573a\u666f\uff1b\u800cTCP\u534f\u8bae\u53ef\u4ee5\u63d0\u4f9b\u53ef\u9760\u7684\u4f20\u8f93\uff0c\u4f46\u662f\u4f1a\u6d88\u8017\u66f4\u591a\u7684\u7f51\u7edc\u8d44\u6e90\uff0c\u9002\u7528\u4e8e\u6587\u4ef6\u4f20\u8f93\u7b49\u5e94\u7528\u573a\u666f\u3002\u56e0\u6b64\uff0c\u5728\u9009\u62e9\u534f\u8bae\u65f6\uff0c\u60a8\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u5e94\u7528\u573a\u666f\u6765\u51b3\u5b9a\u54ea\u79cd\u534f\u8bae\u66f4\u9002\u5408\u60a8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

MQTT\u548cTCP\u662f\u4e24\u79cd\u4e0d\u540c\u7684\u534f\u8bae\uff0c\u5b83\u4eec\u5728\u5e94\u7528\u573a\u666f\u548c\u7279\u6027\u4e0a\u6709\u7740\u660e\u663e\u7684\u5dee\u5f02\u3002\u672c\u6587\u5c06\u6bd4\u8f83MQTT\u548cTCP\u7684\u4f18\u7f3a\u70b9\uff0c\u4ee5\u4fbf\u60a8\u80fd\u591f\u66f4\u597d\u5730\u7406\u89e3\u8fd9\u4e24\u79cd\u534f\u8bae\uff0c\u5e76\u51b3\u5b9a\u54ea\u79cd\u534f\u8bae\u66f4\u9002\u5408\u60a8\u7684\u5e94\u7528\u573a<\/p>\n","protected":false},"author":1,"featured_media":3671,"comment_status":"closed","ping_status":"open","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":[46],"class_list":["post-21147","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-m"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/21147","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=21147"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/21147\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/3671"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=21147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=21147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=21147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}