{"id":4514,"date":"2020-04-09T17:36:08","date_gmt":"2020-04-09T09:36:08","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=4514"},"modified":"2020-04-13T18:57:08","modified_gmt":"2020-04-13T10:57:08","slug":"python-%e7%88%ac%e9%98%b6%e6%a2%af-python-%e6%93%8d%e4%bd%9csocket-%e4%b9%8b%e8%81%8a%e5%a4%a9%e5%ae%a4%e6%9c%8d%e5%8a%a1%e7%ab%af%e7%9a%84%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=4514","title":{"rendered":"Python \u722c\u9636\u68af | Python \u64cd\u4f5csocket \u4e4b\u804a\u5929\u5ba4\u670d\u52a1\u7aef\u7684\u5b9e\u73b0"},"content":{"rendered":"\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u4f7f\u7528 Python \u6765\u64cd\u4f5c socket \uff0c\u5b9e\u73b0\u4e00\u4e2a\u804a\u5929\u5ba4\u7684\u4e00\u4e9b\u4e3b\u8981\u529f\u80fd\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u6211\u4eec\u6765\u56de\u60f3\u4e0b\uff0c\u4e00\u822c\u7684\u804a\u5929\u5ba4\u90fd\u662f\u600e\u6837\u7684\uff0c\u6709\u591a\u4e2a\u7528\u6237\u53ef\u4ee5\u540c\u65f6\u5728\u7ebf\uff0c\u4ed6\u4eec\u53ef\u4ee5\u5b9e\u65f6\u83b7\u53d6\u5230\u6d88\u606f\uff0c\u5b9e\u65f6\u53d1\u9001\u6d88\u606f\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u670d\u52a1\u7aef\u8981\u5b9e\u73b0\u7684\u5c31\u6709\u8fd9\u4e48\u51e0\u70b9\uff1a<\/p>\n\n\n\n<ul><li>\u76d1\u542c\u5ba2\u6237\u7aef\u7684\u8fde\u63a5<\/li><li>\u540c\u65f6\u64cd\u4f5c\u591a\u4e2a\u7528\u6237<\/li><li>\u5e7f\u64ad\u6d88\u606f\u901a\u77e5<\/li><\/ul>\n\n\n\n<p>\u4ee3\u7801\u64b8\u8d77\u6765\uff1a<\/p>\n\n\n\n<p>\u56e0\u4e3a\u6211\u4eec\u8981\u505a\u5230 \u201c\u540c\u65f6\u201d \u53bb\u64cd\u4f5c\u7528\u6237\uff0c\u5c31\u9700\u8981\u7528\u5230\u591a\u7ebf\u7a0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import socket\nfrom threading import Thread<\/code><\/pre>\n\n\n\n<p>\u50cf\u4e0a\u7bc7\u8bf4\u5230\u7684\u4e00\u6837\uff0c\u6765\u521b\u5efa\u4e00\u4e0b socket \uff0c\u7ed1\u5b9a\u5730\u5740\u548c\u7aef\u53e3\u53f7\uff1a<div style=\"text-align:center;border:1px dashed #FF9A9A;padding:8px;margin:10px auto;color:#FF6666;\">\u672c\u6587\u9690\u85cf\u5185\u5bb9 <a href=\"https:\/\/vip.fxxkpython.com\/wp-login.php?redirect_to=https%3A%2F%2Fvip.fxxkpython.com%2F%3Fp%3D4514\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div>\u8fd9\u6837\uff0c\u4e00\u4e2a\u804a\u5929\u5ba4\u7684\u670d\u52a1\u7aef\u4e3b\u8981\u529f\u80fd\u5c31\u5b8c\u6210\u4e86\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"536\" height=\"148\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-09-17-27-33.png\" alt=\"\" class=\"wp-image-4554\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-09-17-27-33.png 536w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-09-17-27-33-300x83.png 300w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/figure><\/div>\n\n\n\n<p>\u5750\u7b49\u7528\u6237\u7684\u8fde\u63a5\uff0c\u4e0b\u4e00\u7bc7\u5c0f\u5e05b\u5c31\u544a\u8bc9\u4f60\u5982\u4f55\u5b9e\u73b0\u804a\u5929\u5ba4\u7684\u5ba2\u6237\u7aef\uff0c\u5982\u4f55\u8fdb\u6765\u5439\u725b\u903c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u4f7f\u7528 Python \u6765\u64cd\u4f5c socket \uff0c\u5b9e\u73b0\u4e00\u4e2a\u804a\u5929\u5ba4\u7684\u4e00\u4e9b\u4e3b\u8981\u529f\u80fd\u3002 \u9996\u5148\u6211\u4eec\u6765\u56de\u60f3\u4e0b\uff0c\u4e00\u822c\u7684\u804a\u5929\u5ba4\u90fd\u662f\u600e\u6837\u7684\uff0c\u6709\u591a\u4e2a\u7528\u6237\u53ef\u4ee5\u540c\u65f6\u5728\u7ebf\uff0c\u4ed6\u4eec\u53ef\u4ee5\u5b9e\u65f6\u83b7\u53d6\u5230\u6d88\u606f\uff0c\u5b9e\u65f6\u53d1\u9001\u6d88\u606f\u3002 \u90a3\u4e48\u670d\u52a1\u7aef\u8981\u5b9e\u73b0\u7684\u5c31\u6709\u8fd9\u4e48\u51e0\u70b9\uff1a \u76d1\u542c\u5ba2\u6237\u7aef\u7684\u8fde\u63a5 \u540c\u65f6&hellip;<\/p>\n","protected":false},"author":1,"featured_media":4554,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[140],"tags":[19,386,381],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/4514"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4514"}],"version-history":[{"count":15,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/4514\/revisions"}],"predecessor-version":[{"id":4585,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/4514\/revisions\/4585"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/4554"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}