{"id":153,"date":"2015-04-10T18:00:54","date_gmt":"2015-04-10T10:00:54","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=153"},"modified":"2026-08-18T12:09:28","modified_gmt":"2026-08-18T04:09:28","slug":"%e5%a4%9a%e7%ba%bf%e7%a8%8b%e7%a8%8b%e5%ba%8f%e6%a8%a1%e5%9e%8b%e4%b9%8b%e7%ba%bf%e7%a8%8b%e6%b1%a0","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=153","title":{"rendered":"\u591a\u7ebf\u7a0b\u7a0b\u5e8f\u6a21\u578b\u4e4b\u7ebf\u7a0b\u6c60"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\">\u591a\u7ebf\u7a0b\u662f\u590d\u6742\u7a0b\u5e8f\u91cc\u51e0\u4e4e\u8eb2\u4e0d\u5f00\u7684\u4e00\u5757\u3002\u4e3a\u4e86\u628a\u8fd0\u884c\u6027\u80fd\u62c9\u4e0a\u6765\uff0c\u628a\u5de5\u4f5c\u62c6\u6210\u591a\u6761\u7ebf\u7a0b\u662f\u5e38\u89c1\u505a\u6cd5\u3002\u4e0b\u9762\u7528\u626b\u63cf\u4e3b\u673a\u7aef\u53e3\u7684\u4f8b\u5b50\uff0c\u628a\u5355\u7ebf\u7a0b\u3001\u4e00\u7aef\u53e3\u4e00\u7ebf\u7a0b\u3001\u4ee5\u53ca\u4e24\u79cd\u7ebf\u7a0b\u6c60\u6a21\u578b\u90fd\u8d70\u4e00\u904d\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u9605\u8bfb\u524d\u63d0\uff1a\u6709\u4e00\u5b9a Java \u57fa\u7840\uff0c\u5bf9 Socket \u4e0d\u964c\u751f\u3002\u539f\u6587\u7a0b\u5e8f\u5728 Java SDK 1.4.2 \u4e0b\u7f16\u8bd1\u8fd0\u884c\u901a\u8fc7\u3002<\/p>\n<p><!--more--><\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u5355\u7ebf\u7a0b\u626b\u7aef\u53e3<\/h2>\n<p style=\"margin: 1em 0px;\">\u4efb\u52a1\uff1a\u626b\u4e00\u53f0\u4e3b\u673a\uff0c\u627e\u51fa\u54ea\u4e9b\u7aef\u53e3\u662f open\u3002\u5148\u7528\u5355\u7ebf\u7a0b\uff0c\u9760 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">java.net.Socket<\/code> \u5224\u65ad\u7aef\u53e3\u662f\u5426\u6253\u5f00\u3002\u4e09\u4e2a\u53c2\u6570\uff1a\u4e3b\u673a IP\u3001\u8d77\u59cb\u7aef\u53e3\u3001\u7ed3\u675f\u7aef\u53e3\uff081\uff5e65535\uff09\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">import java.io.IOException;\n\nimport java.net.Socket;\n\nimport java.net.UnknownHostException;\n\n\n\npublic class PortScannerSingleThread {\n\n    public static void main(String[] args) {\n\n        String host = null;        \/\/\u7b2c\u4e00\u4e2a\u53c2\u6570\uff0c\u76ee\u6807\u4e3b\u673a\u3002\n\n        int beginport = 1;         \/\/\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u5f00\u59cb\u7aef\u53e3\u3002\n\n        int endport = 65535;       \/\/\u7b2c\u4e09\u4e2a\u53c2\u6570\uff0c\u7ed3\u675f\u7aef\u53e3\u3002\n\n        try{\n\n            host = args[0];\n\n            beginport = Integer.parseInt(args[1]);\n\n            endport = Integer.parseInt(args[2]);\n\n            if(beginport &lt;= 0 || endport &gt;= 65536 || beginport &gt; endport){\n\n                throw new Exception(\"Port is illegal\");\n\n            }\n\n        }catch(Exception e){\n\n            System.out.println(\"Usage: java PortScannerSingleThread host beginport endport\");\n\n            System.exit(0);\n\n        }\n\n        \n\n\n\n        for (int i = beginport; i &lt;= endport; i++) {\n\n            try {\n\n                Socket s = new Socket(host, i);\n\n                System.out.println(\"The port \" + i + \" is opened at \" + host);\n\n            }catch (UnknownHostException ex) {\n\n                System.err.println(ex);\n\n                break;\n\n            }catch (IOException ex) {\n\n            }\n\n        }\n\n    }\n\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u8fd0\u884c <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">java PortScannerSingleThread 10.1.1.1 1 1000<\/code> \u4f1a\u770b\u5230\u7c7b\u4f3c\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">The port 25 is opened at 10.1.1.182\nThe port 110 is opened at 10.1.1.182\nThe port 135 is opened at 10.1.1.182\n...<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u628a\u76ee\u6807\u7aef\u53e3\u626b\u4e00\u904d\u8981\u5341\u51e0\u5206\u949f\u751a\u81f3\u66f4\u4e45\uff0c\u8fd9\u79cd\u6548\u7387\u6ca1\u4eba\u80fd\u5fcd\u3002\u5fc5\u987b\u63d0\u901f\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u4e00\u7aef\u53e3\u4e00\u7ebf\u7a0b<\/h2>\n<p style=\"margin: 1em 0px;\">for \u5faa\u73af\u91cc\u4e3a\u6bcf\u4e2a\u7aef\u53e3 new \u4e00\u4e2a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">PortProcessor<\/code> \u7ebf\u7a0b\uff0c\u771f\u6b63\u7684 Socket \u653e\u5728 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">run()<\/code> \u91cc\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">import java.io.IOException;\n\nimport java.net.Socket;\n\nimport java.net.UnknownHostException;\n\n\n\npublic class PortScannerMultiThread {\n\n    public static void main(String[] args) {\n\n        String host = null;\n\n        int beginport = 1;\n\n        int endport = 65535;\n\n        try{\n\n            host = args[0];\n\n            beginport = Integer.parseInt(args[1]);\n\n            endport = Integer.parseInt(args[2]);\n\n            if(beginport &lt;= 0 || endport &gt;= 65536 || beginport &gt; endport){\n\n                throw new Exception(\"Port is illegal\");\n\n            }\n\n        }catch(Exception e){\n\n            System.out.println(\"Usage: java PortScannerSingleThread host beginport endport\");\n\n            System.exit(0);\n\n        }\n\n        \n\n\n\n        for (int i = beginport; i &lt;= endport; i++) {\n\n            PortProcessor pp = new PortProcessor(host,i);      \/\/\u4e00\u4e2a\u7aef\u53e3\u521b\u5efa\u4e00\u4e2a\u7ebf\u7a0b\n\n            pp.start();\n\n        }\n\n    }\n\n}\n\n\n\nclass PortProcessor extends Thread{\n\n    String host;\n\n    int port;\n\n    \n\n    PortProcessor(String host, int port){\n\n        this.host = host;\n\n        this.port = port;\n\n    }\n\n    \n\n    public void run(){\n\n        try{\n\n            Socket s = new Socket(host,port);\n\n            System.out.println(\"The port \" + port + \" is opened at \" + host);\n\n        }catch(UnknownHostException ex){\n\n            System.err.println(ex);\n\n        }catch(IOException ioe){\n\n        }\n\n    }\n\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u6bd4\u5355\u7ebf\u7a0b\u5feb\u5f88\u591a\u500d\uff0c\u626b 1\uff5e1000 \u51e0\u4e4e\u51e0\u79d2\u51fa\u7ed3\u679c\u3002\u8fd0\u884c <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">java PortScannerMultiThread 10.1.1.100 1 1000<\/code>\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">The port 25 is opened at 10.1.1.100\nThe port 42 is opened at 10.1.1.100\nThe port 88 is opened at 10.1.1.100\n...<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u95ee\u9898\u4e5f\u5f88\u660e\u663e\uff1a\u7ebf\u7a0b\u6570\u53d6\u51b3\u4e8e\u8d77\u6b62\u7aef\u53e3\u3002\u626b 1\uff5e100 \u5c31 100 \u6761\u7ebf\u7a0b\uff0c\u626b 1\uff5e10000 \u5c31\u4e00\u4e07\u6761\u3002JVM \u91cc\u521b\u5efa\u3001\u9500\u6bc1\u7ebf\u7a0b\u672c\u8eab\u5c31\u5403\u8d44\u6e90\uff0c\u6240\u4ee5\u8fd9\u4e2a\u7248\u672c\u4e5f\u4e0d\u591f\u7528\u3002\u6211\u4eec\u9700\u8981<strong style=\"color: #4870ac;\">\u6570\u91cf\u786e\u5b9a<\/strong>\u7684\u7ebf\u7a0b\uff0c\u4e5f\u5c31\u662f<strong style=\"color: #4870ac;\">\u7ebf\u7a0b\u6c60<\/strong>\uff08ThreadPool\uff09\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001\u4e24\u79cd\u6c60\u6a21\u578b<\/h2>\n<p style=\"margin: 1em 0px;\">\u7b2c\u4e00\u79cd\uff1a\u6c60\u91cc\u653e<strong style=\"color: #4870ac;\">\u5f85\u5904\u7406\u6570\u636e<\/strong>\u3002\u5148\u5efa\u6c60\uff0c\u5f80\u91cc\u4e22\u5bf9\u8c61\uff0c\u518d\u542f\u52a8\u56fa\u5b9a\u6570\u91cf\u7684\u7ebf\u7a0b\u53bb\u53d6\u3002\u6c60\u7a7a\u5219\u7ebf\u7a0b wait\uff1b\u5f80\u6c60\u91cc\u52a0\u4e00\u4e2a\u5bf9\u8c61\u540e notifyAll\uff0c\u4e00\u4e2a\u5bf9\u8c61\u53ea\u5141\u8bb8\u4e00\u4e2a\u7ebf\u7a0b\u5904\u7406\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u7b2c\u4e8c\u79cd\uff1a\u6c60\u91cc\u653e<strong style=\"color: #4870ac;\">\u5de5\u4eba\u7ebf\u7a0b<\/strong>\u3002\u6ca1\u4e8b\u65f6\u5de5\u4eba\u5f85\u547d\uff1b\u5f80\u6c60\u91cc\u4e22\u4e00\u4e2a\u4efb\u52a1\uff0c\u5de5\u4eba\u5c31\u9886\u8d70\u505a\u5230\u5b8c\u3002<\/p>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u6a21\u578b<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u6c60\u91cc\u88c5\u4ec0\u4e48<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u5bf9\u5e94\u7a0b\u5e8f<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u7ed3\u675f\u65b9\u5f0f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4efb\u52a1\u6c60<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8981\u626b\u7684\u7aef\u53e3\uff08Integer\uff09<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u7a0b\u5e8f 3 PortScanner<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">isFinished() \u540e\u7ebf\u7a0b return<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5de5\u4eba\u6c60<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">PoolWorker\uff0c\u4efb\u52a1\u8d70 execute(Runnable)<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u7a0b\u5e8f 4 ThreadPool + Scanner<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6ca1\u6709\u7ed3\u675f\u5224\u65ad\uff0c\u4f1a\u4e00\u76f4\u8dd1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u56db\u3001\u7a0b\u5e8f 3\uff1a\u6c60\u91cc\u88c5\u7aef\u53e3<\/h2>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">List entries<\/code> \u5f53\u6c60\uff0c\u88c5\u5f85\u626b\u7aef\u53e3\u3002List \u5143\u7d20\u5fc5\u987b\u662f Object\uff0c\u4e0d\u80fd\u4e22\u88f8 int\uff0c\u8981\u7528 Integer\u3002<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">processMethod()<\/code> \u5148\u542f\u52a8\u56fa\u5b9a\u6570\u91cf\u7684 PortThread\uff0c\u518d\u5728 while \u91cc <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">entries.add(0, new Integer(port))<\/code>\u3002\u7ebf\u7a0b\u7684 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">run()<\/code> \u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">entries.remove(entries.size()-1)<\/code> \u53d6\u51fa\uff0c\u8f6c int \u518d\u4ea4\u7ed9 Socket\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">import java.io.IOException;\n\nimport java.net.InetAddress;\n\nimport java.net.Socket;\n\nimport java.net.UnknownHostException;\n\nimport java.util.Collections;\n\nimport java.util.LinkedList;\n\nimport java.util.List;\n\n\n\npublic class PortScanner {\n\n    private List entries = Collections.synchronizedList(new LinkedList());  \/\/\u8fd9\u4e2a\u201d\u6c60\u201c\u6bd4\u8f83\u7279\u522b\n\n    int numofthreads;\n\n    static int port;\n\n    int beginport;\n\n    int endport;\n\n    InetAddress remote = null;\n\n    \n\n    public boolean isFinished(){\n\n        if(port &gt;= endport){\n\n            return true;\n\n        }else{\n\n            return false;\n\n        }\n\n    }\n\n    \n\n    PortScanner(InetAddress addr, int beginport, int endport, int numofthreads){\n\n        this.remote = addr;\n\n        this.beginport = beginport;\n\n        this.endport = endport;\n\n        this.numofthreads = numofthreads;    \n\n    }\n\n    \n\n    public void processMethod(){\n\n        for(int i = 0; i &lt; numofthreads; i++){          \/\/\u521b\u5efa\u4e00\u5b9a\u6570\u91cf\u7684\u7ebf\u7a0b\u5e76\u8fd0\u884c\n\n            Thread t = new PortThread(remote, entries, this);\n\n            t.start();\n\n        }\n\n        \n\n        port = beginport;\n\n        \n\n        while(true){\n\n            if(entries.size() &gt; numofthreads){\n\n                try{\n\n                    Thread.sleep(1000);      \/\/\u201d\u6c60\u201c\u4e2d\u7684\u5185\u5bb9\u592a\u591a\u7684\u8bdd\u5c31sleep\n\n                }catch(InterruptedException ex){\n\n                    \n\n                }\n\n                continue;\n\n            }\n\n            \n\n            synchronized(entries){\n\n                if(port &gt; endport) break;\n\n                entries.add(0, new Integer(port));  \/\/\u5f80\u201d\u6c60\u201c\u91cc\u6dfb\u52a0\u5bf9\u8c61\uff0c\u9700\u8981\u4f7f\u7528int\u5bf9\u5e94\u7684Integer\u7c7b\n\n                entries.notifyAll();\n\n                port++;\n\n            }\n\n        }\n\n    }\n\n    \n\n    public static void main(String[] args) {\n\n        String host = null;\n\n        int beginport = 1;\n\n        int endport = 65535;\n\n        int nThreads = 100;\n\n        try{\n\n            host = args[0];\n\n            beginport = Integer.parseInt(args[1]);\n\n            endport = Integer.parseInt(args[2]);\n\n            nThreads = Integer.parseInt(args[3]);\n\n            if(beginport &lt;= 0 || endport &gt;= 65536 || beginport &gt; endport){\n\n                throw new Exception(\"Port is illegal\");\n\n            }\n\n        }catch(Exception e){\n\n            System.out.println(\"Usage: java PortScannerSingleThread host beginport endport nThreads\");\n\n            System.exit(0);\n\n        }\n\n        \n\n        try{\n\n            PortScanner scanner = new PortScanner(InetAddress.getByName(host), beginport, endport, nThreads);\n\n            scanner.processMethod();\n\n        }catch(UnknownHostException ex){\n\n        }    \n\n    }\n\n}\n\n\n\nclass PortThread extends Thread{\n\n    private InetAddress remote;\n\n    private List entries;\n\n    PortScanner scanner;\n\n    \n\n    PortThread(InetAddress add, List entries, PortScanner scanner){\n\n        this.remote = add;\n\n        this.entries = entries;\n\n        this.scanner = scanner;\n\n    }\n\n            \n\n    public void run(){\n\n        Integer entry;\n\n        while(true){\n\n            synchronized(entries){\n\n                while(entries.size() == 0){\n\n                    if(scanner.isFinished()) return;\n\n                    try{\n\n                        entries.wait();           \/\/\u201d\u6c60\u201c\u91cc\u6ca1\u5185\u5bb9\u5c31\u53ea\u80fd\u7b49\u4e86\n\n                    }catch(InterruptedException ex){\n\n                    }\n\n                }\n\n                entry = (Integer)entries.remove(entries.size()-1);  \/\/\u628a\u201d\u6c60\u201c\u91cc\u7684\u4e1c\u897f\u62ff\u51fa\u6765\u8fdb\u884c\u5904\u7406\n\n            }\n\n            \n\n            Socket s = null;\n\n            \n\n            try{\n\n                s = new Socket(remote, entry.intValue());\n\n                System.out.println(\"The port of \" + entry.toString() + \" of the remote \" + remote +\" is opened.\");\n\n            \n\n            }catch(IOException e){\n\n            }finally{\n\n                try{\n\n                    if(s != null) s.close();\n\n                }catch(IOException e){\n\n                    \n\n                }\n\n            }\n\n        }\n\n    }\n\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u56db\u4e2a\u53c2\u6570\u3002\u8fd0\u884c <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">java PortScanner 10.1.1.182 1 10000 100<\/code>\uff08\u7b2c\u56db\u4e2a\u662f\u7ebf\u7a0b\u6570\uff09\uff0c\u7ed3\u679c\u548c\u524d\u4e24\u4e2a\u7a0b\u5e8f\u4e00\u6837\uff1a\u6bd4\u7a0b\u5e8f 1 \u5feb\uff0c\u53ef\u80fd\u6bd4\u7a0b\u5e8f 2 \u7a0d\u6162\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e94\u3001\u7a0b\u5e8f 4\uff1a\u6c60\u91cc\u88c5\u5de5\u4eba<\/h2>\n<p style=\"margin: 1em 0px;\">\u6c60\u91cc\u7684\u5bf9\u8c61\u6539\u6210\u7ebf\u7a0b\uff08\u5de5\u4eba\uff09\uff0c\u5177\u4f53\u4efb\u52a1\u4f5c\u4e3a\u53c2\u6570\u4ea4\u7ed9\u5de5\u4eba\u3002\u4e24\u4e2a\u6587\u4ef6\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">ThreadPool.java<\/code> \u548c <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">PortScannerByThreadPool.java<\/code>\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">ThreadPool<\/code> \u91cc <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">nThreads<\/code> \u662f\u5de5\u4eba\u6570\uff0c<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">PoolWorker[]<\/code> \u662f\u5de5\u4eba\u6570\u7ec4\u3002\u5de5\u4eba\u7684\u5de5\u4f5c\u5c31\u662f\u5faa\u73af\u5904\u7406\u901a\u8fc7 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">queue.addLast(r)<\/code> \u4e22\u8fdb\u6c60\u91cc\u7684\u4efb\u52a1\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">import java.util.LinkedList;\n\n\n\npublic class ThreadPool{\n\n    private final int nThreads;\n\n    private final PoolWorker[] threads;\n\n    private final LinkedList queue;\n\n\n\n    public ThreadPool(int nThreads){\n\n        this.nThreads = nThreads;\n\n        queue = new LinkedList();\n\n        threads = new PoolWorker[nThreads];\n\n\n\n        for (int i=0; i&lt;nThreads; i++) {\n\n            threads[i] = new PoolWorker();\n\n            threads[i].start();\n\n        }\n\n    }\n\n\n\n    public void execute(Runnable r) {\n\n        synchronized(queue) {\n\n            queue.addLast(r);\n\n            queue.notifyAll();\n\n        }\n\n    }\n\n\n\n    private class PoolWorker extends Thread {\n\n        public void run() {\n\n            Runnable r;\n\n\n\n            while (true) {\n\n                synchronized(queue) {\n\n                    while (queue.isEmpty()) {\n\n                        try{\n\n                            queue.wait();\n\n                        }catch (InterruptedException ignored){\n\n                        }\n\n                    }\n\n\n\n                    r = (Runnable) queue.removeFirst();\n\n                }\n\n\n\n                try {\n\n                    r.run();\n\n                }\n\n                catch (RuntimeException e) {\n\n                }\n\n            }\n\n        }\n\n    }\n\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u4e3b\u7a0b\u5e8f\u540c\u6837\u5403\u56db\u4e2a\u53c2\u6570\uff1a\u4e3b\u673a\u3001\u8d77\u6b62\u7aef\u53e3\u3001\u7ebf\u7a0b\u6570\u3002Scanner \u624d\u662f\u771f\u6b63\u7684\u4efb\u52a1\uff1b<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">new ThreadPool(nThreads)<\/code> \u4e4b\u540e\uff0cfor \u91cc <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">new Scanner(host, i)<\/code> \u518d <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">tp.execute(ps)<\/code> \u628a\u4efb\u52a1\u6d3e\u7ed9\u5de5\u4eba\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">import java.io.IOException;\n\nimport java.net.InetAddress;\n\nimport java.net.Socket;\n\n\n\npublic class PortScannerByThreadPool {\n\n    public static void main(String[] args) {\n\n        String host = null;\n\n        int beginport = 1;\n\n        int endport = 65535;\n\n        int nThreads = 100;\n\n        try{\n\n            host = args[0];\n\n            beginport = Integer.parseInt(args[1]);\n\n            endport = Integer.parseInt(args[2]);\n\n            nThreads = Integer.parseInt(args[3]);\n\n            if(beginport &lt;= 0 || endport &gt;= 65536 || beginport &gt; endport){\n\n                throw new Exception(\"Port is illegal\");\n\n            }\n\n        }catch(Exception e){\n\n            System.out.println(\"Usage: java PortScannerSingleThread host beginport endport nThreads\");\n\n            System.exit(0);\n\n        }\n\n        \n\n        ThreadPool tp = new ThreadPool(nThreads);\n\n        \n\n        for(int i = beginport; i &lt;= endport; i++){\n\n            Scanner ps = new Scanner(host,i);\n\n            tp.execute(ps);\n\n        }\n\n    }\n\n}\n\n    \n\nclass Scanner implements Runnable{\n\n    String host;    \n\n    int port;\n\n        \n\n    Scanner(String host, int port){\n\n        this.host = host;\n\n        this.port = port;\n\n    }\n\n        \n\n    public void run(){\n\n        Socket s = null;\n\n        try{\n\n            s = new Socket(InetAddress.getByName(host),port);\n\n            System.out.println(\"The port of \" + port + \" is opened.\");\n\n        }catch(IOException ex){\n\n        }finally{\n\n            try{\n\n                if(s != null) s.close();\n\n            }catch(IOException e){\n\n            }\n\n        }\n\n    }\n\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u7ed3\u679c\u548c\u524d\u9762\u76f8\u540c\u3002\u6700\u5927\u5dee\u522b\uff1a\u7a0b\u5e8f 4 \u4f1a\u4e00\u76f4\u8fd0\u884c\u3001\u4e0d\u4f1a\u81ea\u52a8\u7ed3\u675f\u3002\u7a0b\u5e8f 3 \u6709 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">isFinished()<\/code> \u5224\u65ad\u4efb\u52a1\u662f\u5426\u505a\u5b8c\uff0c\u7a0b\u5e8f 4 \u6ca1\u6709\u2014\u2014\u8fd9\u4e00\u70b9\u7559\u7ed9\u8bfb\u8005\u60f3\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u516d\u3001wait \/ notify \u624d\u662f\u6c60\u7684\u5fc3\u810f<\/h2>\n<p style=\"margin: 1em 0px;\">\u4e24\u79cd\u6a21\u578b\u5173\u952e\u6bb5\u843d\u51e0\u4e4e\u4e00\u6837\uff1a\u90fd\u662f\u4e24\u6bb5 synchronized\u3002\u7a0b\u5e8f 4 \u91cc\u662f\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">synchronized(queue) {\n\n    queue.addLast(r);\n\n    queue.notifyAll();\n\n}\n\n\u548c\n\nsynchronized(queue) {\n\n    while (queue.isEmpty()) {\n\n        try{\n\n            queue.wait();\n\n        }catch (InterruptedException ignored){\n\n        }\n\n    }\n\n\n\n    r = (Runnable) queue.removeFirst();\n\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">synchronized<\/code> \u7528\u6765\u4fee\u9970\u65b9\u6cd5\u6216\u4ee3\u7801\u5757\uff0c\u4fdd\u8bc1\u540c\u4e00\u65f6\u523b\u53ea\u6709\u4e00\u6761\u7ebf\u7a0b\u8fdb\u5165\uff0c\u907f\u514d\u6570\u636e\u5199\u4e71\u3002\u7a0b\u5e8f 3 \u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">Collections.synchronizedList(new LinkedList())<\/code> \u5305\u4e00\u5c42\uff1b\u7a0b\u5e8f 4 \u76f4\u63a5\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">LinkedList queue<\/code>\u3002\u6c60\u91cc\u7684\u8bbf\u95ee\u5df2\u7ecf\u5728 synchronized \u5757\u91cc\uff0c\u4e0d\u7528 synchronizedList \u4e5f\u53ef\u4ee5\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">wait()<\/code> \u548c <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">notifyAll()<\/code> \u662f Object \u7684\u65b9\u6cd5\uff0c\u4efb\u4f55\u7c7b\u90fd\u80fd\u8c03\u3002\u5bb9\u6613\u6df7\u7684\u4e00\u70b9\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">queue.wait()<\/code> \u4e0d\u662f\u8ba9 queue \u5bf9\u8c61\u53bb\u7b49\uff0c\u800c\u662f\u8ba9<strong style=\"color: #4870ac;\">\u5f53\u524d\u7ebf\u7a0b<\/strong>\u7b49\uff0c\u5e76\u91ca\u653e\u5bf9 queue \u7684\u9501\uff0c\u628a\u8bbf\u95ee\u6743\u4ea4\u7ed9\u522b\u4eba\u3002\u7ec6\u8282\u89c1 JDK \u6587\u6863\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u7a0b\u5e8f 3 \u7684\u6c60\u88c5\u5f85\u5904\u7406\u5bf9\u8c61\uff0c\u7a0b\u5e8f 4 \u7684\u6c60\u88c5\u5de5\u4eba\u3001\u518d\u628a\u4efb\u52a1\u6d3e\u5de5\u3002\u4e2a\u4eba\u66f4\u504f\u597d\u540e\u8005\uff1a\u7c7b\u591a\u51e0\u4e2a\uff0c\u4f46\u903b\u8f91\u6e05\u695a\u3002\u8fd9\u4e24\u79cd\u6a21\u578b\u662f\u591a\u7ebf\u7a0b\u8bbe\u8ba1\u91cc\u51e0\u4e4e\u8eb2\u4e0d\u5f00\u7684\u5185\u5bb9\u3002<\/p>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u4e0d\u8981\u4e00\u7aef\u53e3\u4e00\u7ebf\u7a0b\uff1a\u56fa\u5b9a\u6570\u91cf\u7684\u5de5\u4eba + wait\/notify \u7684\u4efb\u52a1\u961f\u5217\uff0c\u624d\u662f\u80fd\u843d\u5730\u7684\u7ebf\u7a0b\u6c60\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u591a\u7ebf\u7a0b\u662f\u590d\u6742\u7a0b\u5e8f\u91cc\u51e0\u4e4e\u8eb2\u4e0d\u5f00\u7684\u4e00\u5757\u3002\u4e3a\u4e86\u628a\u8fd0\u884c\u6027\u80fd\u62c9\u4e0a\u6765\uff0c\u628a\u5de5\u4f5c\u62c6\u6210\u591a\u6761\u7ebf\u7a0b\u662f\u5e38\u89c1\u505a\u6cd5\u3002\u4e0b\u9762\u7528\u626b\u63cf\u4e3b\u673a\u7aef\u53e3\u7684\u4f8b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[178,44],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/153"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=153"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":309,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions\/309"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}