{"id":69365,"date":"2023-12-18T07:29:26","date_gmt":"2023-12-17T23:29:26","guid":{"rendered":"\/\/www.viralrail.com\/?p=69365"},"modified":"2023-12-18T07:29:26","modified_gmt":"2023-12-17T23:29:26","slug":"mxyuhst","status":"publish","type":"post","link":"\/\/www.viralrail.com\/blog\/69365.html","title":{"rendered":"MQTT\u534f\u8bae\uff1aUDP\u8fd8\u662fTCP"},"content":{"rendered":"

  MQTT\u534f\u8bae\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae\uff0c\u5e38\u7528\u4e8e\u7269\u8054\u7f51\u8bbe\u5907<\/a>\u95f4\u7684\u901a\u4fe1\u3002\u672c\u6587\u5c06\u63a2\u8ba8MQTT\u534f\u8bae\u4f7f\u7528\u7684\u662fUDP<\/a>\u8fd8\u662fTCP\uff0c\u4ee5\u53ca\u5b83\u4eec\u5404\u81ea\u7684\u4f18\u52a3\u52bf\u3002<\/p>\n

MQTT\u534f\u8bae\u6982\u8ff0<\/h2>\n

  MQTT\uff08Message Queuing Telemetry Transport\uff09\u662f\u4e00\u79cd\u57fa\u4e8e\u53d1\u5e03\/\u8ba2\u9605\u6a21\u5f0f\u7684\u901a\u4fe1\u534f\u8bae\uff0c\u6700\u521d\u7531IBM\u5f00\u53d1\u3002\u5b83\u88ab\u8bbe\u8ba1\u7528\u4e8e\u4f4e\u5e26\u5bbd\u3001\u4e0d\u7a33\u5b9a\u7f51\u7edc\u6216\u8005\u5bf9\u7f51\u7edc\u5ef6\u8fdf\u654f\u611f\u7684\u73af\u5883\u4e0b\u7684\u901a\u4fe1\u3002<\/p>\n

  \u5de5\u4f5c\u539f\u7406<\/h3>\n

  MQTT\u91c7\u7528\u8f7b\u91cf\u7ea7\u7684\u534f\u8bae\u5934\uff0c\u5360\u7528\u8f83\u5c11\u7684\u7f51\u7edc\u8d44\u6e90\uff0c\u9002\u7528\u4e8e\u79fb\u52a8\u8bbe\u5907\u7b49\u8d44\u6e90\u53d7\u9650\u7684\u73af\u5883\u3002\u5b83\u4f7f\u7528\u53d1\u5e03\/\u8ba2\u9605\u6d88\u606f\u6a21\u5f0f\uff0c\u901a\u8fc7MQTT\u4ee3\u7406\u670d\u52a1\u5668\uff08broker\uff09\u8fdb\u884c\u6d88\u606f\u8f6c\u53d1\u3002<\/p>\n

  \u7279\u70b9<\/h3>\n

  MQTT\u534f\u8bae\u5177\u6709\u5373\u65f6\u901a\u8baf\u3001\u6570\u636e\u91cf\u5c0f\u3001\u5b9e\u65f6\u6027\u597d\u7684\u7279\u70b9\uff0c\u56e0\u6b64\u5728\u7269\u8054\u7f51\u3001\u4f20\u611f\u5668\u7f51\u7edc\u3001\u79fb\u52a8\u8bbe\u5907\u7b49\u9886\u57df\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\u3002<\/p>\n

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

  MQTT\u534f\u8bae\u5b9e\u9645\u4e0a\u662f\u5efa\u7acb\u5728TCP\u534f\u8bae\u4e4b\u4e0a\u7684\uff0c\u5b83\u4f7f\u7528TCP\u534f\u8bae\u63d0\u4f9b\u7684\u53ef\u9760\u4f20\u8f93\u7279\u6027\u8fdb\u884c\u6570\u636e\u901a\u4fe1\u3002\u6b64\u5916\uff0cMQTT\u534f\u8bae\u4e5f\u53ef\u4ee5\u8fd0\u884c\u5728\u57fa\u4e8eUDP\u534f\u8bae\u7684MQTT-SN\uff08MQTT for Sensor Networks\uff09\u7248\u672c\u3002<\/p>\n

  TCP\u534f\u8bae\u4e0eMQTT<\/h3>\n

  TCP\uff08Transmission Control Protocol\uff09\u662f\u4e00\u79cd\u53ef\u9760\u7684\u3001\u9762\u5411\u8fde\u63a5\u7684\u534f\u8bae\uff0c\u9002\u7528\u4e8e\u5bf9\u6570\u636e\u4f20\u8f93\u53ef\u9760\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\u3002MQTT\u5728TCP\u534f\u8bae\u4e0a\u5efa\u7acb\u8fde\u63a5\uff0c\u901a\u8fc7TCP\u8fdb\u884c\u6570\u636e\u4f20\u8f93\uff0c\u4fdd\u8bc1\u6d88\u606f\u7684\u53ef\u9760\u6027\u3002<\/p>\n

  \u4f18\u52bf<\/h4>\n

  \u901a\u8fc7TCP\u4f20\u8f93\uff0c\u4fdd\u8bc1\u4e86\u6d88\u606f\u7684\u53ef\u9760\u6027\u548c\u7a33\u5b9a\u6027\uff0c\u9002\u7528\u4e8e\u5bf9\u6d88\u606f\u4f20\u8f93\u5b89\u5168\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\u3002<\/p>\n

  \u52a3\u52bf<\/h4>\n

  TCP\u534f\u8bae<\/a>\u5728\u6570\u636e\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u4f1a\u5e26\u6765\u4e00\u5b9a\u7684\u5f00\u9500\uff0c\u56e0\u6b64\u5bf9\u4e8e\u4e00\u4e9b\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u5e94\u7528\u6765\u8bf4\uff0c\u53ef\u80fd\u4f1a\u5f71\u54cd\u6027\u80fd\u3002<\/p>\n

  UDP\u534f\u8bae\u4e0eMQTT-SN<\/h3>\n

  UDP\uff08User Datagram Protocol\uff09\u662f\u4e00\u79cd\u65e0\u8fde\u63a5\u7684\u3001\u4e0d\u53ef\u9760\u7684\u7f51\u7edc\u4f20\u8f93\u534f\u8bae\uff0c\u9002\u7528\u4e8e\u4e00\u4e9b\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u8f83\u9ad8\uff0c\u4f46\u5bf9\u6570\u636e\u4f20\u8f93\u53ef\u9760\u6027\u8981\u6c42\u8f83\u4f4e\u7684\u573a\u666f\u3002MQTT-SN\u662f\u4e13\u95e8\u4e3a\u4f20\u611f\u5668\u7f51\u7edc\u8bbe\u8ba1\u7684MQTT\u7248\u672c\uff0c\u53ef\u4ee5\u5728UDP\u534f\u8bae\u4e0a\u8fd0\u884c\u3002<\/p>\n

  \u4f18\u52bf<\/h4>\n

  UDP\u534f\u8bae\u7684\u65e0\u8fde\u63a5\u6027\u548c\u4f4e\u5f00\u9500\u4f7f\u5f97\u6570\u636e\u4f20\u8f93\u66f4\u5feb\uff0c\u9002\u7528\u4e8e\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\uff0c\u5982\u4f20\u611f\u5668\u6570\u636e\u91c7\u96c6\u3002<\/p>\n

  \u52a3\u52bf<\/h4>\n

  UDP\u534f\u8bae\u7531\u4e8e\u4e0d\u4fdd\u8bc1\u6570\u636e\u53ef\u9760\u4f20\u8f93\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6d88\u606f\u4e22\u5931\u6216\u4e71\u5e8f\uff0c\u4e0d\u9002\u7528\u4e8e\u5bf9\u6d88\u606f\u53ef\u9760\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  MQTT\u534f\u8bae\u4f7f\u7528TCP\u4f5c\u4e3a\u5e95\u5c42\u4f20\u8f93\u534f\u8bae\uff0c\u4fdd\u8bc1\u4e86\u6d88\u606f\u7684\u53ef\u9760\u6027\uff0c\u9002\u7528\u4e8e\u5bf9\u6d88\u606f\u4f20\u8f93\u5b89\u5168\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\u3002<\/strong>\u540c\u65f6\uff0cMQTT-SN\u7248\u672c\u53ef\u4ee5\u5728UDP\u534f\u8bae\u4e0a\u8fd0\u884c\uff0c\u9002\u7528\u4e8e\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6839\u636e\u4e0d\u540c\u7684\u573a\u666f\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u534f\u8bae\u7248\u672c\uff0c\u624d\u80fd\u66f4\u597d\u5730\u6ee1\u8db3\u901a\u4fe1\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

MQTT\u534f\u8bae\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae\uff0c\u5e38\u7528\u4e8e\u7269\u8054\u7f51\u8bbe\u5907\u95f4\u7684\u901a\u4fe1\u3002\u672c\u6587\u5c06\u63a2\u8ba8MQTT\u534f\u8bae\u4f7f\u7528\u7684\u662fUDP\u8fd8\u662fTCP\uff0c\u4ee5\u53ca\u5b83\u4eec\u5404\u81ea\u7684\u4f18\u52a3\u52bf\u3002MQTT\u534f\u8bae\u6982\u8ff0MQTT\uff08<\/p>\n","protected":false},"author":1,"featured_media":64231,"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-69365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-udp"],"_links":{"self":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts\/69365"}],"collection":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/comments?post=69365"}],"version-history":[{"count":0,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts\/69365\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/media\/64231"}],"wp:attachment":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/media?parent=69365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/categories?post=69365"},{"taxonomy":"post_tag","embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/tags?post=69365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}