I have a socket connecting to a proxy then to a remote server i specify. However i want multiple connections to the remove server from the proxy. So i want to create 4 sockets to the same proxy and from the 4 sockets connect to the remote server.
When i do this it doesn't work, it only connects to the proxy once.
Here is psuedo code:
static Socket[] liveCon = new Socket[300];
// This is the class that assigns a proxy and connects
// it is a temporary thread that connects and ends.
sockClass sockets = new sockClass;
class main {
for (int i = 0; i < livecon.length; i++) {
sockets[i].start(); // Thread ends after it is connected
}
}
class sockClass{
main.liveCon[index] = new Socket(proxy);
main.liveCon[index].connect(ep);
main.liveCon[index].setPerformancePreferences(1, 2, 0);
if (main.liveCon[index].isConnected() == true) {
myOutput = new PrintStream(main.liveCon[index].getOutputStream());
main.liveCon[index].setKeepAlive(true);
}
}