Hello I am new to python , I am writing a code which generates dns requests
from socket import error as socket_error
import threading
from random import randint
from time import sleep
def task(number):
try :
HOST = Random_website.random_website().rstrip() # fetches url
PORT = 80 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
print(str(number) +":"+HOST +"Connected")
except socket_error as serr:
if serr.errno != errno.ECONNREFUSED:
# Not the error we are looking for, re-raise
raise serr
thread_list = []
for i in range(1, 100):
t = threading.Thread(target=task, args=(i,))
thread_list.append(t)
for thread in thread_list:
thread.start()
Executing above code throws this error, can anyone help me out of this I am pulling out my hair from one day
Thanks in advance