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