Python Forum

Full Version: Threading issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im having a hard time understanding Threading.
I have 2 pieces of code.
The first one (code a) works perfectly fine using Threading
The second one (code b) works but threading does not work

code a = pastebin AfHR9JMn
code b = pastebin yqKFGeXw

Code a creates 100 threads and starts them all
Code b creates thread 1, starts it, finishes it, then creates thread 2.

Im am doing the same for both so i dont understand why i am getting 2 different results.

Requirement: Code b should create 100 threads and run them simultaneously.

fyi: code b requires a file called indexed.csv and at least 100 urls in it. if you dont want to make you own use this one:
pastebin dtrsAwSF
urls are taken from generation from code b
Should we really help you writing DDOS attacks?
(Mar-16-2017, 01:21 PM)Ofnuts Wrote: [ -> ]Should we really help you writing DDOS attacks?

I already wrote that one. and its nothing that a quick google search couldn't find.
tbh i only wrote that so i could DDOS myself while getting into a lobby of GTAV. if you port forward port 80 to your PC and run that while getting  into a public session, it will lag so bad it will put you in a public session by yourself and no one else can join XD

anyway, the second code is just a web scraper and will be used to demo cluster computing on a network level. that's the one your helping with.
Where's the code?
(Mar-19-2017, 11:07 PM)nilamo Wrote: [ -> ]Where's the code?
Can look at it as a riddle Wink
Quote:code a = pastebin AfHR9JMn
AfHR9JMn
If the code's too long to post directly on the forum, it's too long for me to read through :)
Im a new users so cant post links yet, that's why i just left the pastebin code.

Anyway, i didn't want to make a huge post and due to not knowing if certain parts effect threading i wanted the include the entire code rather than a snippet.

I did however find the solution.

In the old code i was creating a thread: 
t[i] = threading.Thread(target=mainthread(indexed[i], debug))
the problem was the way i was setting the variables to send through. I have now changed it to:
t[i] = threading.Thread(target=mainthread, args=(indexed[i], debug))