{"id":204769,"date":"2025-05-29T10:13:55","date_gmt":"2025-05-29T02:13:55","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204769\/"},"modified":"2025-05-29T10:13:55","modified_gmt":"2025-05-29T02:13:55","slug":"windows-%e4%b8%8a%e4%bd%bf%e7%94%a8-python-%e7%9a%84-select-%e6%a8%a1%e5%9d%97%e6%97%b6%ef%bc%8c%e5%a6%82%e4%bd%95%e9%81%bf%e5%85%8d-oserror-winerror-10038-%e9%94%99%e8%af%af%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204769\/","title":{"rendered":"Windows \u4e0a\u4f7f\u7528 Python \u7684 select \u6a21\u5757\u65f6\uff0c\u5982\u4f55\u907f\u514d OSError: [WinError 10038] \u9519\u8bef\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Windows \u4e0a\u4f7f\u7528 Python \u7684 select \u6a21\u5757\u65f6\uff0c\u5982\u4f55\u907f\u514d OSError: [WinError 10038] \u9519\u8bef\uff1f<\/h1>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u7262\u56fa\u624e\u5b9e\u7684\u57fa\u7840\u662f\u5341\u5206\u91cd\u8981\u7684\uff0c\u5c31\u6765\u5e26\u5927\u5bb6\u4e00\u70b9\u70b9\u7684\u638c\u63e1\u57fa\u7840\u77e5\u8bc6\u70b9\u3002\u4eca\u5929\u672c\u7bc7\u6587\u7ae0\u5e26\u5927\u5bb6\u4e86\u89e3\u300aWindows \u4e0a\u4f7f\u7528 Python \u7684 select \u6a21\u5757\u65f6\uff0c\u5982\u4f55\u907f\u514d OSError: [WinError 10038] \u9519\u8bef\uff1f\u300b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e86\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u5feb\u70b9\u6536\u85cf\u8d77\u6765\u5427\uff0c\u5426\u5219\u9700\u8981\u65f6\u5c31\u627e\u4e0d\u5230\u4e86\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241115\/1731672049673737f10149b.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>python \u4f7f\u7528select io \u591a\u8def\u590d\u7528\u906d\u9047oserror: [winerror 10038]<\/strong><\/p>\n<p>\u5728\u4f7f\u7528python \u7684select \u6a21\u5757\u5b9e\u73b0io \u591a\u8def\u590d\u7528\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u5728windows \u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5c06\u6587\u4ef6\u64cd\u4f5c\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165select\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5982\u4e0b\u9519\u8bef\uff1a<\/p>\n<p>oserror: [winerror 10038] \u5728\u4e00\u4e2a\u975e\u5957\u63a5\u5b57\u4e0a\u5c1d\u8bd5\u4e86\u4e00\u4e2a\u64cd\u4f5c<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3a\u5728windows \u4e0a\uff0cselect \u4e0d\u80fd\u7528\u4e8e\u6587\u4ef6\u3002 select \u4f7f\u7528\u7684\u5e95\u5c42\u51fd\u6570\u662f\u7531 winsock \u5e93\u63d0\u4f9b\u7684\uff0c\u800c\u5b83\u53ea\u652f\u6301\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u4e0d\u652f\u6301\u6765\u81ea\u5176\u4ed6\u6765\u6e90\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002 <\/p>\n<p>\u5bf9\u4e8e windows \u7cfb\u7edf\uff0c\u89e3\u51b3\u65b9\u6cd5\u662f\u4ec5\u5c06\u5957\u63a5\u5b57\u4f5c\u4e3a select \u7684\u53c2\u6570\u3002\u4f8b\u5982\uff0c\u5728\u793a\u4f8b\u4ee3\u7801\u4e2d\uff0c\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u4ee3\u7801\u884c\uff1a<\/p>\n<pre>rs, ws, xs = select([s], [fd], [])<\/pre>\n<p>\u66ff\u6362\u4e3a\uff1a<\/p>\n<pre>rs, ws, xs = select([s], [], [])<\/pre>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u907f\u514d\u9519\u8bef\u5e76\u6b63\u786e\u4f7f\u7528 select \u6a21\u5757\u6765\u76d1\u542c\u5957\u63a5\u5b57\u3002 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300aWindows \u4e0a\u4f7f\u7528 Python \u7684 select \u6a21\u5757\u65f6\uff0c\u5982\u4f55\u907f\u514d OSError: [WinError 10038] \u9519\u8bef\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows \u4e0a\u4f7f\u7528 Pyth&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204769","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204769"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204769\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}