導入sjava-2.1.6.jar包,今天上傳資源有問題,下次傳了之后再補充到這里。
      public static List<String> resoveSrv(String query) { //   	   String s = "ramuh.example.com";  // the inputted string, I need to obtain the Port to be added to this  	    ArrayList<String> ret = new ArrayList<String>(); //  	    String query = "_rdp._tcp." + s;  	    try{  	        Record[] records = new Lookup(query,Type.SRV).run();  // returning null  	        if(records != null && records.length > 0) {  	            for(Record r : records) {  	                SRVRecord srv = (SRVRecord)r;  	                String hostname = srv.getTarget().toString().replaceFirst("//.$", "");  	                int port = srv.getPort();  	                ret.add(hostname + ":" + port);  	            }  	            return ret;  	        }  	        else{  	           return null;  	        }  	    } catch (TextParseException e) {  	        return null;  	    }      }2、4行是注釋掉的
 
  | 
新聞熱點
疑難解答