プロキシに接続してから、指定したリモートサーバーに接続するソケットがあります。ただし、プロキシから削除サーバーへの複数の接続が必要です。だから私は同じプロキシに4つのソケットを作成し、4つのソケットからリモートサーバーに接続したいと考えています。
これを行うと機能しません。プロキシに一度だけ接続します。
疑似コードは次のとおりです。
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);
}
}