导入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行是注释掉的
新闻热点
疑难解答