有没有办法将字符串参数传递给 的参数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?