{"id":25352,"date":"2023-09-05T15:19:13","date_gmt":"2023-09-05T07:19:13","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=25352"},"modified":"2023-09-05T15:19:18","modified_gmt":"2023-09-05T07:19:18","slug":"ckfwqytkhdcsxj","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/25352.html","title":{"rendered":"\u4e32\u53e3\u670d\u52a1\u5668\u4e0eTCP\u5ba2\u6237\u7aef\u53c2\u6570\u8be6\u89e3"},"content":{"rendered":"\n
\u3000\u3000\u4e32\u53e3\u670d\u52a1\u5668(Serial Port Server)\u548cTCP\u5ba2\u6237\u7aef(TCP Client)\u662f\u7f51\u7edc\u901a\u4fe1\u4e2d\u5e38\u7528\u7684\u4e24\u79cd\u8bbe\u5907\u3002\u4e32\u53e3\u670d\u52a1\u5668\u4f5c\u4e3a\u4e00\u4e2a\u7f51\u7edc\u8bbe\u5907\uff0c\u5c06\u4e32\u53e3\u8bbe\u5907\u8fde\u63a5\u5230\u7f51\u7edc\u4e0a\uff0c\u5b9e\u73b0\u4e32\u53e3\u8bbe\u5907\u7684\u8fdc\u7a0b\u8bbf\u95ee\u548c\u63a7\u5236\u3002<\/strong>\u800cTCP\u5ba2\u6237\u7aef\u5219\u662f\u901a\u8fc7TCP\u534f\u8bae\u4e0e\u670d\u52a1\u5668\u8fdb\u884c\u901a\u4fe1\u7684\u4e00\u79cd\u8bbe\u5907\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u4e32\u53e3\u670d\u52a1\u5668\u548cTCP\u5ba2\u6237\u7aef\u7684\u53c2\u6570\u8bbe\u7f6e\u548c\u4f7f\u7528\u65b9\u6cd5\u3002<\/p>\n\n\n\n \u3000\u3000\u5728\u4f7f\u7528\u4e32\u53e3\u670d\u52a1\u5668\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u8bbe\u7f6e\u4e32\u53e3\u7684\u53c2\u6570\uff0c\u5305\u62ec\u6ce2\u7279\u7387(Baud Rate)\u3001\u6570\u636e\u4f4d(Data Bits)\u3001\u505c\u6b62\u4f4d(Stop Bits)\u3001\u6821\u9a8c\u4f4d(Parity)\u7b49\u3002\u8fd9\u4e9b\u53c2\u6570\u7684\u8bbe\u7f6e\u9700\u8981\u4e0e\u8981\u8fde\u63a5\u7684\u4e32\u53e3\u8bbe\u5907\u76f8\u5339\u914d\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u7684\u6b63\u786e\u4f20\u8f93\u3002<\/p>\n\n\n\n \u3000\u3000\u4e32\u53e3\u670d\u52a1\u5668\u4f5c\u4e3a\u4e00\u4e2a\u7f51\u7edc\u8bbe\u5907\uff0c\u9700\u8981\u8bbe\u7f6e\u7f51\u7edc\u53c2\u6570\uff0c\u5305\u62ecIP\u5730\u5740\u3001\u5b50\u7f51\u63a9\u7801\u3001\u7f51\u5173\u7b49\u3002\u8fd9\u4e9b\u53c2\u6570\u7684\u8bbe\u7f6e\u9700\u8981\u4e0e\u7f51\u7edc\u73af\u5883\u76f8\u5339\u914d\uff0c\u4ee5\u786e\u4fdd\u4e32\u53e3\u670d\u52a1\u5668\u80fd\u591f\u6b63\u5e38\u8fde\u63a5\u5230\u7f51\u7edc\u3002<\/p>\n\n\n\n \u3000\u3000\u4e32\u53e3\u670d\u52a1\u5668\u652f\u6301\u591a\u79cd\u8fde\u63a5\u65b9\u5f0f\uff0c\u5305\u62ecTCP\u8fde\u63a5\u3001UDP\u8fde\u63a5\u7b49\u3002\u5728\u8bbe\u7f6e\u8fde\u63a5\u53c2\u6570\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u8fde\u63a5\u7684\u76ee\u6807IP\u5730\u5740\u548c\u7aef\u53e3\u53f7\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\u3001\u91cd\u8fde\u95f4\u9694\u7b49\u53c2\u6570\uff0c\u4ee5\u63d0\u9ad8\u8fde\u63a5\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n\n\n\n \u3000\u3000TCP\u5ba2\u6237\u7aef\u9700\u8981\u8bbe\u7f6e\u8fde\u63a5\u7684\u76ee\u6807IP\u5730\u5740\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u5efa\u7acb\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u3002\u5728\u8bbe\u7f6e\u8fde\u63a5\u53c2\u6570\u65f6\uff0c\u53ef\u4ee5\u6307\u5b9a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\u3001\u91cd\u8fde\u95f4\u9694\u7b49\u53c2\u6570\uff0c\u4ee5\u63d0\u9ad8\u8fde\u63a5\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n\n\n\n \u3000\u3000TCP\u5ba2\u6237\u7aef\u53ef\u4ee5\u8bbe\u7f6e\u6570\u636e\u4f20\u8f93\u7684\u76f8\u5173\u53c2\u6570\uff0c\u5305\u62ec\u6570\u636e\u53d1\u9001\u7f13\u51b2\u533a\u5927\u5c0f\u3001\u6570\u636e\u63a5\u6536\u7f13\u51b2\u533a\u5927\u5c0f\u7b49\u3002\u901a\u8fc7\u5408\u7406\u8bbe\u7f6e\u8fd9\u4e9b\u53c2\u6570\uff0c\u53ef\u4ee5\u63d0\u9ad8\u6570\u636e\u4f20\u8f93\u7684\u6548\u7387\u548c\u53ef\u9760\u6027\u3002<\/p>\n\n\n\n \u3000\u3000TCP\u5ba2\u6237\u7aef\u53ef\u4ee5\u8bbe\u7f6e\u4e0d\u540c\u7684\u5de5\u4f5c\u6a21\u5f0f\uff0c\u5305\u62ec\u4e3b\u52a8\u6a21\u5f0f\u548c\u88ab\u52a8\u6a21\u5f0f\u3002\u5728\u4e3b\u52a8\u6a21\u5f0f\u4e0b\uff0c\u5ba2\u6237\u7aef\u4e3b\u52a8\u53d1\u8d77\u8fde\u63a5\u8bf7\u6c42;\u5728\u88ab\u52a8\u6a21\u5f0f\u4e0b\uff0c\u5ba2\u6237\u7aef\u7b49\u5f85\u670d\u52a1\u5668\u7684\u8fde\u63a5\u8bf7\u6c42\u3002\u6839\u636e\u5b9e\u9645\u9700\u6c42\uff0c\u9009\u62e9\u5408\u9002\u7684\u5de5\u4f5c\u6a21\u5f0f\u3002<\/p>\n\n\n\n \u3000\u3000\u4e09\u3001\u4f7f\u7528\u4e32\u53e3\u670d\u52a1\u5668\u4e0eTCP\u5ba2\u6237\u7aef<\/p>\n\n\n\n \u3000\u3000\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5c06\u4e32\u53e3\u8bbe\u5907\u8fde\u63a5\u5230\u4e32\u53e3\u670d\u52a1\u5668\u4e0a\uff0c\u5e76\u786e\u4fdd\u4e32\u53e3\u670d\u52a1\u5668\u4e0e\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\u3002\u7136\u540e\uff0c\u901a\u8fc7TCP\u5ba2\u6237\u7aef\u4e0e\u4e32\u53e3\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5\u3002<\/p>\n\n\n\n \u3000\u3000\u6839\u636e\u5b9e\u9645\u9700\u6c42\uff0c\u8bbe\u7f6e\u4e32\u53e3\u670d\u52a1\u5668\u548cTCP\u5ba2\u6237\u7aef\u7684\u53c2\u6570\u3002\u786e\u4fdd\u53c2\u6570\u8bbe\u7f6e\u6b63\u786e\uff0c\u4ee5\u4fdd\u8bc1\u6570\u636e\u7684\u6b63\u786e\u4f20\u8f93\u548c\u901a\u4fe1\u7684\u7a33\u5b9a\u6027\u3002<\/p>\n\n\n\n \u3000\u3000\u4e00\u65e6\u8fde\u63a5\u5efa\u7acb\u6210\u529f\u5e76\u53c2\u6570\u8bbe\u7f6e\u5b8c\u6210\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u8fdb\u884c\u6570\u636e\u4f20\u8f93\u4e86\u3002\u901a\u8fc7TCP\u5ba2\u6237\u7aef\u5411\u4e32\u53e3\u670d\u52a1\u5668\u53d1\u9001\u6570\u636e\uff0c\u4e32\u53e3\u670d\u52a1\u5668\u5c06\u6570\u636e\u8f6c\u53d1\u7ed9\u4e32\u53e3\u8bbe\u5907\uff0c\u7136\u540e\u5c06\u8bbe\u5907\u8fd4\u56de\u7684\u6570\u636e\u518d\u901a\u8fc7TCP\u5ba2\u6237\u7aef\u53d1\u9001\u56de\u6765\u3002<\/p>\n\n\n\n \u3000\u3000\u5f53\u6570\u636e\u4f20\u8f93\u5b8c\u6210\u6216\u4e0d\u518d\u9700\u8981\u8fde\u63a5\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5173\u95edTCP\u5ba2\u6237\u7aef\u4e0e\u4e32\u53e3\u670d\u52a1\u5668\u7684\u8fde\u63a5\u6765\u65ad\u5f00\u8fde\u63a5\u3002<\/p>\n\n\n\n \u3000\u3000\u4e32\u53e3\u670d\u52a1\u5668\u548cTCP\u5ba2\u6237\u7aef\u662f\u7f51\u7edc\u901a\u4fe1\u4e2d\u5e38\u7528\u7684\u4e24\u79cd\u8bbe\u5907\uff0c\u901a\u8fc7\u5408\u7406\u8bbe\u7f6e\u53c2\u6570\u548c\u4f7f\u7528\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5b9e\u73b0\u4e32\u53e3\u8bbe\u5907\u7684\u8fdc\u7a0b\u8bbf\u95ee\u548c\u63a7\u5236\u3002\u5728\u4f7f\u7528\u4e32\u53e3\u670d\u52a1\u5668\u548cTCP\u5ba2\u6237\u7aef\u65f6\uff0c\u6211\u4eec\u9700\u8981\u6ce8\u610f\u53c2\u6570\u8bbe\u7f6e\u7684\u6b63\u786e\u6027<\/strong>\uff0c\u786e\u4fdd\u6570\u636e\u7684\u6b63\u786e\u4f20\u8f93\u548c\u901a\u4fe1\u7684\u7a33\u5b9a\u6027\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u60a8\u4e86\u89e3\u4e32\u53e3\u670d\u52a1\u5668\u548cTCP\u5ba2\u6237\u7aef\u7684\u53c2\u6570\u8bbe\u7f6e\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u4e32\u53e3\u670d\u52a1\u5668(Serial Port Server)\u548cTCP\u5ba2\u6237\u7aef(TCP Client)\u662f\u7f51\u7edc\u901a\u4fe1\u4e2d\u5e38\u7528\u7684\u4e24\u79cd\u8bbe\u5907\u3002\u4e32\u53e3\u670d\u52a1\u5668\u4f5c\u4e3a\u4e00\u4e2a\u7f51\u7edc\u8bbe\u5907\uff0c\u5c06\u4e32\u53e3\u8bbe\u5907\u8fde\u63a5\u5230\u7f51\u7edc\u4e0a\uff0c\u5b9e\u73b0\u4e32\u53e3\u8bbe\u5907\u7684\u8fdc\u7a0b\u8bbf\u95ee\u548c\u63a7\u5236\u3002<\/p>\n","protected":false},"author":1,"featured_media":2124,"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":[67],"class_list":["post-25352","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-ckfwq"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/25352","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=25352"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/25352\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/2124"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=25352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=25352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=25352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\u3000\u3000\u4e00\u3001\u4e32\u53e3\u670d\u52a1\u5668\u53c2\u6570\u8bbe\u7f6e<\/h2>\n\n\n\n
\u3000\u30001. \u4e32\u53e3\u53c2\u6570<\/h3>\n\n\n\n
\u3000\u30002. \u7f51\u7edc\u53c2\u6570<\/h3>\n\n\n\n
\u3000\u30003. \u8fde\u63a5\u53c2\u6570<\/h3>\n\n\n\n
\u3000\u3000\u4e8c\u3001TCP\u5ba2\u6237\u7aef\u53c2\u6570\u8bbe\u7f6e<\/h2>\n\n\n\n
\u3000\u30001. \u8fde\u63a5\u53c2\u6570<\/h3>\n\n\n\n
\u3000\u30002. \u6570\u636e\u4f20\u8f93\u53c2\u6570<\/h3>\n\n\n\n
\u3000\u30003. \u5ba2\u6237\u7aef\u6a21\u5f0f\u53c2\u6570<\/h3>\n\n\n\n
\u3000\u30001. \u8fde\u63a5\u8bbe\u5907<\/h3>\n\n\n\n
\u3000\u30002. \u53c2\u6570\u8bbe\u7f6e<\/h3>\n\n\n\n
\u3000\u30003. \u6570\u636e\u4f20\u8f93<\/h3>\n\n\n\n
\u3000\u30004. \u65ad\u5f00\u8fde\u63a5<\/h3>\n\n\n\n
\u3000\u3000\u603b\u7ed3\uff1a<\/h2>\n\n\n\n