{"id":4452,"date":"2020-04-02T23:05:21","date_gmt":"2020-04-02T15:05:21","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=4452"},"modified":"2020-04-02T23:15:08","modified_gmt":"2020-04-02T15:15:08","slug":"python-%e7%88%ac%e9%98%b6%e6%a2%af-%e4%bb%80%e4%b9%88%e6%98%af-python-%e7%9a%84-scoket-%e7%bc%96%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=4452","title":{"rendered":"Python \u722c\u9636\u68af |\u4ec0\u4e48\u662f Python \u7684 socket \u7f16\u7a0b"},"content":{"rendered":"\n<p>\u4f60\u5e94\u8be5\u770b\u8fc7\u4e00\u4e9b\u5b9e\u65f6\u52a8\u6001\u7684\u6570\u636e\uff0c\u6bd4\u5982\u4e00\u4e9b\u6570\u636e\u7684\u6da8\u5e45\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"959\" height=\"413\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-40-28.png\" alt=\"\" class=\"wp-image-4454\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-40-28.png 959w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-40-28-300x129.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-40-28-768x331.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-40-28-769x331.png 769w\" sizes=\"(max-width: 959px) 100vw, 959px\" \/><\/figure><\/div>\n\n\n\n<p>\u6216\u8005\u4e00\u4e9b\u804a\u5929\u5ba4\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"806\" height=\"584\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-42-44.png\" alt=\"\" class=\"wp-image-4455\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-42-44.png 806w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-42-44-300x217.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-42-44-768x556.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-21-42-44-769x557.png 769w\" sizes=\"(max-width: 806px) 100vw, 806px\" \/><\/figure><\/div>\n\n\n\n<p>\u9664\u4e86\u8f6e\u8bad\u5916\uff0c\u7c7b\u4f3c\u4e0a\u9762\u8fd9\u4e9b\u5b9e\u65f6\u52a8\u6001\u6570\u636e\u7684\u83b7\u53d6\u4ee5\u53ca\u53d1\u9001\uff0c\u90fd\u7528\u5230\u4e86 socket \u6280\u672f\u3002<\/p>\n\n\n\n<h2>\u4ec0\u4e48\u662f Socket\uff1f<\/h2>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u628a\u5b83\u7406\u89e3\u4e3a\u4e00\u4e2a\u901a\u4fe1\u7684\u5de5\u5177\uff0c\u4e3b\u8981\u662f\u5b9e\u73b0\u7aef\u5230\u7aef\u7684\u6570\u636e\u4f20\u8f93\uff0c\u800c\u8fd9\u4e2a\u7aef\u70b9\u5c31\u662f socket\uff0c\u4eba\u4eec\u4e5f\u5e38\u4f1a\u8bf4\u5b83\u662f\u5957\u63a5\u5b57\uff0c\u5b83\u4e3b\u8981\u7531 ip \u548c\u7aef\u53e3\u6784\u6210\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>127.0.0.1:8080<\/p><\/blockquote>\n\n\n\n<p>\u8fd9\u5c31\u662f\u4e00\u4e2a socket\u3002<\/p>\n\n\n\n<p>\u5f53\u4e24\u4e2a socket \u80fd\u591f\u786e\u8ba4\u8fde\u63a5\uff0c\u5728\u4f20\u8f93\u5c42\u4e2d\uff0c\u5b83\u4eec\u4e4b\u95f4\u5c31\u53ef\u4ee5\u5f00\u59cb\u901a\u4fe1\u4e86\u3002<\/p>\n\n\n\n<p>\u5f53\u7136\u5728\u901a\u4fe1\u7684\u8fc7\u7a0b\u9700\u8981\u5b9a\u4e49\u4f20\u8f93\u7684\u63a5\u53e3\u534f\u8bae\uff0c\u6bd4\u5982 TCP\u3001UDP\u3002\u81f3\u4e8e\u4f20\u8f93\u5c42\uff0c\u662f\u8ba1\u7b97\u673a\u7f51\u7edc\u7684\u5206\u5c42\u4e4b\u4e00\uff0c\u8fd9\u4e9b\u6211\u5f80\u540e\u4f1a\u4e13\u95e8\u8ddf\u4f60\u8bb2\u8ba1\u7b97\u673a\u7f51\u7edc\u76f8\u5173\u7684\u77e5\u8bc6\u3002<\/p>\n\n\n\n<p>\u4e86\u89e3\u4e86\u4ec0\u4e48\u662f Socket \u4e4b\u540e\uff0c\u63a5\u4e0b\u6765\u6211\u8ddf\u4f60\u8bf4\u8bf4\uff0c\u5728 Python \u4e2d\u5982\u4f55\u5b9e\u73b0 Socket \u4e4b\u95f4\u7684\u901a\u4fe1\u3002<\/p>\n\n\n\n<h2 id=\"mce_15\">Python \u64cd\u4f5c Socket<\/h2>\n\n\n\n<p>\u8981\u5b9e\u73b0\u4e00\u4e2a socket\uff0c\u4e00\u822c\u6765\u8bf4\u9700\u8981\u8fd9\u4e48\u51e0\u4e2a\u6b65\u9aa4\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%3D4452\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div>\u6211\u4eec\u73b0\u5728\u5148\u5f00\u542f\u670d\u52a1\u7aef\uff0c\u518d\u5f00\u542f\u5ba2\u6237\u7aef\uff0c\u770b\u770b\u6548\u679c\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"1265\" height=\"540\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Peek-2020-04-02-22-38.gif\" alt=\"\" class=\"wp-image-4468\"\/><\/figure><\/div>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5f53\u670d\u52a1\u7aef\u5f00\u542f\u7684\u65f6\u5019\uff0c\u5c31\u5f00\u59cb\u76d1\u542c\u5ba2\u6237\u7aef\u7684 socket \u8fde\u63a5\uff0c\u5ba2\u6237\u7aef\u8fde\u63a5\u540e\u53ef\u4ee5\u6536\u5230\u670d\u52a1\u7aef\u53d1\u6765\u7684\u6d88\u606f\u3002<\/p>\n\n\n\n<p>\u8fd9\u662f Python \u5bf9 socket \u6700\u7b80\u5355\u7684\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p>\u521a\u521a\u7684\u6f14\u793a\u4ee3\u7801\u4e3b\u8981\u662f\u4e3a\u4e86\u8ba9\u4f60\u660e\u767d socket \u7684\u521b\u5efa\u6d41\u7a0b\uff0c\u5b9e\u9645\u4e0a socket \u53ef\u4ee5\u4f7f\u7528\u6211\u4eec\u4e4b\u524d\u8bf4\u8fc7\u7684 with \u8bed\u53e5\u3002<\/p>\n\n\n\n<h3>\u8fd9\u662f\u670d\u52a1\u7aef\u4f8b\u5b50\uff1a<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"734\" height=\"488\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-22-51-19.png\" alt=\"\" class=\"wp-image-4469\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-22-51-19.png 734w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-22-51-19-300x199.png 300w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/figure><\/div>\n\n\n\n<h3>\u8fd9\u662f\u5ba2\u6237\u7aef\u4f8b\u5b50\uff1a<br><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"734\" height=\"488\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-22-51-23.png\" alt=\"\" class=\"wp-image-4470\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-22-51-23.png 734w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-02-22-51-23-300x199.png 300w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/figure><\/div>\n\n\n\n<p>\u901a\u8fc7\u8fd9\u4e00\u4e2a\u5c0f\u4f8b\u5b50\uff08\u6700\u597d\u662f\u4f60\u628a\u8fd9\u51e0\u884c\u4ee3\u7801\u6572\u4e00\u4e0b\uff0c\u8fd0\u884c\u4e00\u4e0b\uff09\uff0c\u76f8\u4fe1\u4f60\u5bf9 socket \u6709\u4e86\u4e9b\u8bb8\u4e86\u89e3\u4e86\uff0c\u4f46\u8fd9\u4ec5\u4ec5\u662f\u4e00\u4e2a\u524d\u83dc\uff0c\u5982\u4f55\u7fa4\u53d1\uff0c\u5982\u4f55\u53d1\u7ed9\u7279\u5b9a\u7684\u4e00\u4e2a\u4eba\uff0c\u6216\u8005\u8bf4\u5982\u4f55\u901a\u8fc7 Python \u5b9e\u73b0\u4e00\u4e2a\u804a\u5929\u5ba4\uff1f\u4e0b\u4e00\u7bc7\u6211\u7ed9\u4f60\u8bf4\u9053\u8bf4\u9053\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u5e94\u8be5\u770b\u8fc7\u4e00\u4e9b\u5b9e\u65f6\u52a8\u6001\u7684\u6570\u636e\uff0c\u6bd4\u5982\u4e00\u4e9b\u6570\u636e\u7684\u6da8\u5e45\uff1a \u6216\u8005\u4e00\u4e9b\u804a\u5929\u5ba4\uff1a \u9664\u4e86\u8f6e\u8bad\u5916\uff0c\u7c7b\u4f3c\u4e0a\u9762\u8fd9\u4e9b\u5b9e\u65f6\u52a8\u6001\u6570\u636e\u7684\u83b7\u53d6\u4ee5\u53ca\u53d1\u9001\uff0c\u90fd\u7528\u5230\u4e86 socket \u6280\u672f\u3002 \u4ec0\u4e48\u662f Socket\uff1f \u4f60\u53ef\u4ee5\u628a\u5b83\u7406\u89e3\u4e3a\u4e00\u4e2a\u901a\u4fe1\u7684\u5de5\u5177\uff0c\u4e3b\u8981\u662f\u5b9e\u73b0\u7aef\u5230\u7aef\u7684\u6570\u636e\u4f20\u8f93\uff0c\u800c\u8fd9\u4e2a\u7aef\u70b9\u5c31&hellip;<\/p>\n","protected":false},"author":1,"featured_media":4468,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[140],"tags":[380,141,382,381],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/4452"}],"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=4452"}],"version-history":[{"count":8,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/4452\/revisions"}],"predecessor-version":[{"id":4477,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/4452\/revisions\/4477"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/4468"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}