13 Replies - 376 Views - Last Post: 27 July 2011 - 10:07 AM Rate Topic: -----

#1 globus25  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 19
  • Joined: 07-July 11

Problem - MultiThreading with List

Posted 27 July 2011 - 07:37 AM

I made proxy checker that works on multithreading through Task.Factory but there is one problem because I setup "bots" to 10 and always must click one more time button to check another 10 proxies.
I convert proxy list from listbox to List(List<string> etc.)
Could someone show me resolve to that problem or some pseudocode so I can write my own?

Here is how I start 10" bots":

Task[] check= new Task[10];
            for (int i = 0; i < 10; i++)
            {
                check[i] = Task.Factory.StartNew(() =>
                    {
                        checkProxy();
                    });
            }

Part 2 - checkProxy() code:
private void checkProxy()
{
	pBOT++; // current number in List
	string[] proxy=proxies[pBOT];
	/////////////////////////
	////Processing proxy
	/////////////////////////
}
  


And I need it to process the rest of proxies continually without me clicking again.

different explanation:

I have 30 names in list... I start 10 threads in loop(for) to process first 10 names... but when that for is finished there is 20 unprocessed names...

so how to make thread to go after another name?

PS. please be easy on post like : "U don`t know what U doing etc." - I`m asking because the multitasking is only problem for me...

Is This A Good Question/Topic? 0
  • +

Replies To: Problem - MultiThreading with List

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9383
  • View blog
  • Posts: 35,228
  • Joined: 12-June 08

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 07:45 AM

Why wouldn't you start up three threads and give each a list of ten names? You need to think of threads as parallel chunks of code running over say different data.
Was This Post Helpful? 0
  • +
  • -

#3 globus25  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 19
  • Joined: 07-July 11

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 07:49 AM

yep I though about... I mean doing it that way... but what happens if I load list of 10k proxies?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9383
  • View blog
  • Posts: 35,228
  • Joined: 12-June 08

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 07:53 AM

You divide it up accordingly. A basic for loop would work well.
Was This Post Helpful? 0
  • +
  • -

#5 globus25  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 19
  • Joined: 07-July 11

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 07:59 AM

But timeout will block my threads/loops - that is why the proxy must be passed to threads
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9383
  • View blog
  • Posts: 35,228
  • Joined: 12-June 08

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:02 AM

Timeout - well that's new information added to the equation. Exactly what is your app doing with the proxies that they time out so quickly?

You know you can have more than a handful of threads, right? 10 threads for 1000 names, or 100 threads for ten names.. what eva.
Was This Post Helpful? 0
  • +
  • -

#7 globus25  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 19
  • Joined: 07-July 11

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:04 AM

Yep I know but that program is training before something bigger :)

Timeout - set to 15s will, my app(proxy used in it) is connecting to site and to proxyjudge(testing anonymity)...
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9383
  • View blog
  • Posts: 35,228
  • Joined: 12-June 08

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:06 AM

Okay you need to explain more about the goal of this project if I am to narrow down a solution for you.

Was there a question in that last post?
Was This Post Helpful? 0
  • +
  • -

#9 globus25  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 19
  • Joined: 07-July 11

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:10 AM

Okey I will explain in details that program:)

1.Load proxy list
2.Check proxies against proxyjudge
-timeout - 15seconds (loops - not efficient way)
3.Check proxies against site

So it must be this way :
1.starting 10 threads
2.each of them gets 1 proxy
3.if thread is finished(proxy checking done) it gets another proxy until the list is finished
4. returns good proxies(that part I know ;) )

This post has been edited by globus25: 27 July 2011 - 08:10 AM

Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9383
  • View blog
  • Posts: 35,228
  • Joined: 12-June 08

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:15 AM

Maybe I am a bit dense today, but why would you need to check that many proxies each second?

Why are you fixated on 10 threads?

I still don't see why the threads can't be given a chunk of the list and each process on their own time.

Additionally when a thread is done just spin up a new thread with another name on the list. You don't need to keep it around for any reason. They are not some sort of short supply resource.
Was This Post Helpful? 0
  • +
  • -

#11 globus25  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 19
  • Joined: 07-July 11

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:22 AM

sorry about that it can be 15 threads but main idea is to make it efficient and low on internet connection.. biegger picture of program is for searching "dorks" so it is about maintaining on low connections all time... because with those 15 threads(now) every each of them will be checking some different stuff.... and each connection must retrive data... ( but data part and dorks etc. is not a problem) just making it steady for 15 connections at time and rotate proxies through those connections

"Additionally when a thread is done just spin up a new thread with another name on the list. You don't need to keep it around for any reason. They are not some sort of short supply resource. "

don`t really get that part(maybe because of my english-2nd language)
Was This Post Helpful? -1
  • +
  • -

#12 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9383
  • View blog
  • Posts: 35,228
  • Joined: 12-June 08

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:25 AM

Dorks?
Was This Post Helpful? 0
  • +
  • -

#13 globus25  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 19
  • Joined: 07-July 11

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 08:25 AM

sql injection stuff

bigger program - "crawler"

This post has been edited by globus25: 27 July 2011 - 08:26 AM

Was This Post Helpful? -2
  • +
  • -

#14 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6076
  • View blog
  • Posts: 23,545
  • Joined: 23-August 08

Re: Problem - MultiThreading with List

Posted 27 July 2011 - 10:07 AM

We're not going to help you with malicious activity.

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1