0
有沒有辦法將字符串參數傳遞給參數InetSocketAddress
?將字符串傳遞給InetSocketAddress
這是生成代理正確的方法:
SocketAddress addr = new InetSocketAddress("127.0.0.1", 9050);
Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
但我想創建方法採取在一個字符串是這樣的:
method("127.0.0.1",9050);
public void method (String a){
SocketAddress addr = new InetSocketAddress(a); //can't place string here is there away forit work?
Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
}
有沒有什麼辦法讓新InetSocketAddress
取字符串IP?
我只是寫一個... +1。 – syb0rg