何らかの理由で私のスレッドが自分の仕事を無視しているのですが、なぜこれをやっているのか誰にも分かりません。ヘルプは非常に歓迎され、非常に感謝、ありがとうございます。このプログラムは何ですか私は束を買ってきたし、別のユーザーとプロキシのようやっていきますので、ProxyCheckerは/ etcには、合格しかし、いくつかはC#マルチスレッドはワーカー/ジョブを開始しませんか?
static List<String> user = new List<String>();
static List<String> pass = new List<String>();
static List<String> ips = new List<String>();
static Random rnd = new Random();
static void Main(string[] args)
{
int threads = 4;
loadips();
Console.WriteLine("Enter the amount of threads to run (4 default):");
threads = Int32.Parse(Console.ReadLine());
Console.WriteLine("Starting on " + threads + " threads...");
for (int i = 0; i < threads; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(CheckProxy), i);
}
//Console.ReadLine();
}
public class MyIP
{
public string IP { get; set; }
public bool AcceptsConnection { get; set; }
}
private static void CheckProxy(object state)
{
var u = user[0];
var p = pass[0];
var l = new List<MyIP>();
Parallel.ForEach(l.ToArray(), (item) =>
{
string ip = getip();
try
{
using (var client = new ProxyClient(ip, u, p))
{
Console.WriteLine(ip, user, pass);
client.Connect();
item.AcceptsConnection = client.IsConnected;
}
}
catch
{
l.Remove(item);
}
});
foreach (var item in l)
{
if (item.AcceptsConnection == true)
{
WriteToFile(user[0], pass[0]);
}
Console.WriteLine(item.IP + " is " + (item.AcceptsConnection) + " accepts connections" + " doesn not accept connections");
}
}
private static void loadips()
{
using (TextReader tr = new StreamReader("ips.txt"))
{
string line = null;
while ((line = tr.ReadLine()) != null)
{
ips.Add(line);
}
}
}
アプリは、それがメイン() 'の実行は'前だそう仕上げ以上である
getip()
方法を失います他のものは仕上げています。 'System.Threading.WaitHandle'クラスを見てください。 – Cameron