I'm trying to create a socket, then connect to the same server until I can't make any connection from my PC and I face a problem : my program is WAY faster with Python 2.7 than with Python 3.7.
Here a minimal example:
import time import socket begin = time.time() socket_list =  while True: try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) s.connect(("192.168.2.136", 443)) socket_list.append(s) except: print(len(socket_list)) print(time.time() - begin) for sock in socket_list: sock.close() break
Ouput with Python 3.7:
Ouput with Python 2.7:
Config: Windows 10 (I can put some detail if necessary)