Python Forum
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threading issue
#1
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
Reply
#2
Should we really help you writing DDOS attacks?
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#3
(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.
Reply
#4
Where's the code?
Reply
#5
(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
Reply
#6
If the code's too long to post directly on the forum, it's too long for me to read through :)
Reply
#7
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))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Concurrent futures threading running at same speed as non-threading billykid999 13 1,813 May-03-2023, 08:22 AM
Last Post: billykid999
  Tutorials on sockets, threading and multi-threading? muzikman 2 2,120 Oct-01-2021, 08:32 PM
Last Post: muzikman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020