{"id":77413,"date":"2023-12-30T10:40:24","date_gmt":"2023-12-30T02:40:24","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=77413"},"modified":"2023-12-30T10:40:24","modified_gmt":"2023-12-30T02:40:24","slug":"mxythsu","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/77413.html","title":{"rendered":"MQTT\u534f\u8bae\uff1aTCP\u8fd8\u662fUDP\uff1f"},"content":{"rendered":"

  MQTT\u534f\u8bae\u4f5c\u4e3a\u7269\u8054\u7f51\u9886\u57df\u4e2d\u5e38\u7528\u7684\u901a\u4fe1\u534f\u8bae\uff0c\u5176\u4f20\u8f93\u57fa\u4e8e\u5e95\u5c42\u7684TCP\u6216UDP\u534f\u8bae\u3002\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8MQTT\u534f\u8bae\u53ca\u5176\u5e95\u5c42\u4f20\u8f93\u534f\u8bae\u7684\u7279\u70b9\u53ca\u9002\u7528\u573a\u666f\u3002<\/p>\n

MQTT\u534f\u8bae\u4e0eTCP\u5173\u7cfb<\/h2>\n

  \u5728\u63a2\u8ba8MQTT\u534f\u8bae\u4e0eTCP\u7684\u5173\u7cfb\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u4e86\u89e3MQTT\u662f\u4e00\u79cd\u57fa\u4e8e\u53d1\u5e03\/\u8ba2\u9605\u6a21\u5f0f\u7684\u901a\u4fe1\u534f\u8bae\uff0c\u5e38\u7528\u4e8e\u7269\u8054\u7f51\u9886\u57df\u4e2d\u8bbe\u5907\u95f4\u7684\u6570\u636e\u4f20\u8f93\u3002<\/p>\n

  MQTT\u4e3a\u4f55\u9009\u62e9TCP\u4f5c\u4e3a\u4f20\u8f93\u534f\u8bae\uff1f<\/h3>\n

  MQTT\u9009\u62e9TCP\u4f5c\u4e3a\u4f20\u8f93\u534f\u8bae\u7684\u539f\u56e0\u4e3b\u8981\u662fTCP\u534f\u8bae<\/a>\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002TCP\u53ef\u786e\u4fdd\u6570\u636e\u7684\u53ef\u9760\u4f20\u8f93\uff0c\u80fd\u591f\u5904\u7406\u4e22\u5305\u548c\u4e22\u5931\u8fde\u63a5\u7684\u60c5\u51b5\uff0c\u8fd9\u5bf9\u4e8e\u7269\u8054\u7f51\u8bbe\u5907\u6765\u8bf4\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n

  TCP\u5728MQTT\u4e2d\u7684\u5e94\u7528\u573a\u666f<\/h3>\n

  \u7531\u4e8eTCP\u534f\u8bae\u7684\u7a33\u5b9a\u6027\uff0cMQTT\u534f\u8bae\u5728\u5bf9\u6570\u636e\u4f20\u8f93\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\uff0c\u5982\u5de5\u4e1a\u81ea\u52a8\u5316\u3001\u667a\u80fd\u57ce\u5e02\u7b49\u9886\u57df\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\u3002TCP\u7684\u53ef\u9760\u6027\u4fdd\u969c\u4e86\u6570\u636e\u4f20\u8f93\u7684\u7a33\u5b9a\u6027\uff0c\u7b26\u5408\u8fd9\u4e9b\u9886\u57df\u5bf9\u4e8e\u6570\u636e\u4f20\u8f93\u7684\u9ad8\u8981\u6c42\u3002<\/p>\n

MQTT\u534f\u8bae\u4e0eUDP<\/a>\u5173\u7cfb<\/h2>\n

  \u76f8\u6bd4\u4e8eTCP\uff0cUDP\u662f\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u4f20\u8f93\u5c42<\/a>\u534f\u8bae\u3002\u90a3\u4e48\uff0cMQTT\u4e0eUDP\u534f\u8bae\u53c8\u6709\u600e\u6837\u7684\u5173\u7cfb\u5462\uff1f\u63a5\u4e0b\u6765\u5c06\u5bf9\u8fd9\u4e00\u95ee\u9898\u505a\u51fa\u89e3\u7b54\u3002<\/p>\n

  MQTT\u4e3a\u4f55\u4e0d\u9009\u62e9UDP\u4f5c\u4e3a\u4f20\u8f93\u534f\u8bae\uff1f<\/h3>\n

  \u76f8\u5bf9\u4e8eTCP\uff0cUDP\u534f\u8bae\u662f\u4e00\u79cd\u65e0\u8fde\u63a5\u7684\u3001\u4e0d\u53ef\u9760\u7684\u534f\u8bae\uff0c\u5b83\u4e0d\u4fdd\u8bc1\u6570\u636e\u4f20\u8f93\u7684\u53ef\u9760\u6027\u548c\u987a\u5e8f\u6027\u3002\u8fd9\u5728\u7269\u8054\u7f51\u573a\u666f\u4e0b\uff0c\u7279\u522b\u662f\u9700\u8981\u6570\u636e\u51c6\u786e\u6027\u7684\u9886\u57df\u663e\u7136\u4e0d\u592a\u9002\u5408\u3002<\/p>\n

  UDP\u5728MQTT\u4e2d\u7684\u9002\u7528\u573a\u666f<\/h3>\n

  \u5c3d\u7ba1\u5bf9\u4e8e\u5927\u591a\u6570MQTT\u5e94\u7528\u573a\u666f\u6765\u8bf4\uff0c\u9009\u62e9TCP\u4f5c\u4e3a\u5e95\u5c42\u4f20\u8f93\u534f\u8bae\u66f4\u4e3a\u5408\u9002\uff0c\u4f46\u5728\u4e00\u4e9b\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u8f83\u9ad8\u3001\u53ef\u4ee5\u5bb9\u5fcd\u4e00\u5b9a\u6570\u636e\u4e22\u5931\u7684\u573a\u666f\u4e2d\uff0c\u5982\u5728\u7ebf\u6e38\u620f\u3001\u97f3\u89c6\u9891\u4f20\u8f93\u7b49\uff0cUDP\u53ef\u80fd\u662f\u4e00\u4e2a\u66f4\u597d\u7684\u9009\u62e9\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u5728\u9009\u62e9MQTT\u534f\u8bae\u7684\u5e95\u5c42\u4f20\u8f93\u534f\u8bae\u65f6\uff0c\u9700\u8981\u6839\u636e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u6765\u7efc\u5408\u8003\u8651TCP\u548cUDP\u7684\u7279\u70b9\u3002<\/strong>TCP\u7684\u7a33\u5b9a\u6027\u80fd\u591f\u6ee1\u8db3\u7edd\u5927\u591a\u6570\u7269\u8054\u7f51\u9886\u57df\u5bf9\u4e8e\u6570\u636e\u4f20\u8f93\u7684\u9700\u6c42\uff0c\u800cUDP\u5219\u66f4\u9002\u7528\u4e8e\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u8f83\u9ad8\u4e14\u53ef\u4ee5\u5bb9\u5fcd\u4e00\u5b9a\u6570\u636e\u4e22\u5931\u7684\u573a\u666f\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u9700\u8981\u6839\u636e\u9700\u6c42\u6765\u8fdb\u884c\u9009\u62e9\uff0c\u4ee5\u6c42\u6700\u4f73\u7684\u4f20\u8f93\u6548\u679c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

MQTT\u534f\u8bae\u4f5c\u4e3a\u7269\u8054\u7f51\u9886\u57df\u4e2d\u5e38\u7528\u7684\u901a\u4fe1\u534f\u8bae\uff0c\u5176\u4f20\u8f93\u57fa\u4e8e\u5e95\u5c42\u7684TCP\u6216UDP\u534f\u8bae\u3002\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8MQTT\u534f\u8bae\u53ca\u5176\u5e95\u5c42\u4f20\u8f93\u534f\u8bae\u7684\u7279\u70b9\u53ca\u9002\u7528\u573a\u666f\u3002MQTT\u534f\u8bae\u4e0eTCP\u5173\u7cfb<\/p>\n","protected":false},"author":1,"featured_media":64183,"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":[323],"class_list":["post-77413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-udp"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/77413"}],"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=77413"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/77413\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/64183"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=77413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=77413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=77413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}