#python #python-3.x #sockets
#python #python-3.x #сокеты
Вопрос:
у меня есть эта ошибка в моем коде, и я не уверен, как от нее избавиться. код устанавливает соединения с несколькими сокетами к одному и тому же серверу, но я получаю эту ошибку
Traceback (most recent call last):
File "C:UsersuserDesktopfile.py", line 73, in <module>
connect_to(target, port)
File "C:UsersuserDesktopfile.py", line 68, in connect_to
int_nob.send("User-Agent: {}rn".format(random.choice(user_agents)).encode("utf-8"))
AttributeError: 'NoneType' object has no attribute 'send
часть кода, которая затронута
def connect_to(ip, port1):
int_nob = int(200)#num of bots
for x in range(0, int_nob):
print(int(int_nob))
int_nob -= 1
int_nob = s.connect((ip, port1))
int_nob.send("User-Agent: {}rn".format(random.choice(user_agents)).encode("utf-8"))
if int_nob == 0:
print(list_of_sockets)
print("resending sockets of " int_nob)
while True:
connect_to(target, port)
у меня есть все
import os
И т.д.
import random
s = socket.socket(AF_INET, socket.SOCK_STREM)
port = 445
я также не использую потоки