views:

75

answers:

0
Socket skt;
Proxy proxy = new Proxy(Proxy.Type.SOCKS,
    new InetSocketAddress(proxy_address,proxy_port));
Socket server = new Socket(address, port);
skt = new Socket(proxy);

try {

   skt.setSoTimeout(5*1000);
   skt.connect(server.getRemoteSocketAddress());

} catch (Exception e) {}

the skt socket creates a new socket with the proxy in it and conencts using the server socket address.

Im creating this object class in many instances through an array. I was just wondering why this lags soooo much. I have an http connection as well but that is written differently and runs fine.

Is there any advice to optimize this code to make it run with no lag?