B
B
bot123123 robotovkiy1232020-05-06 22:48:10
linux
bot123123 robotovkiy123, 2020-05-06 22:48:10

[Errno 11001] getaddrinfo failed?

Good afternoon.
On Linux is Python3.6.9 - the code works as it should.
On Windows Python3.8.2 - error [Errno 11001] getaddrinfo failed.
Why is that ?

def timeout_try_1(ip,port,timeout):
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  sock.settimeout(timeout)
  
  try:
    connect = sock.connect((ip,int(port)))
    print(ip.rstrip('\r\n') + ' ' + port)
    write_ip_in_file(port, ip)
    connect.close()

  except socket.timeout:
    t2 = threading.Thread(target = timeout_try_2, args = (ip, port, float('0.1')))
    t2.start()
    t2.join(0.01)

  except Exception as e:
    print(e)


def timeout_try_2(ip, port, timeout):
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  sock.settimeout(timeout)

  try:
    connect = sock.connect((ip,int(port)))
    print(ip.rstrip('\r\n') + ' ' + port)
    write_ip_in_file(port, ip)
    connect.close()

  except socket.timeout:
    pass

  except Exception as e:
    print(e)

for port in ports:
    file_result_ips = open('result_ips.txt', 'r')
    for ip in file_result_ips:
        t1 = threading.Thread(target = timeout_try_1, args = (ip, port, float('0.01')))
        t1.start()
        t1.join(0.001)

Mistake:
connect = sock.connect((ip,int(port)))
socket.gaierror: [Errno 11001] getaddrinfo failed

Reconfigured timeouts - does not help. Disconnected Firewall - too.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Official account of the Timeweb team, 2020-06-10
@timeweb_team

Answer from Timeweb support)
It is necessary to check which ip and port are specified in the corresponding variables, and also, in general, check their availability from the computer where the script is run.
Write more introductory and support will support

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question