socket.socket() correctly fails with RuntimeError: Failed to allocate socket. after creating all available sockets (4 for 5100S, 8 for 5500):
socks = []
while True:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socks.append(s)
print(f"{s} {s.sendto(b'\xFF', (HOST, PORT))}")
time.sleep(1)
socket.socket() will create sockets forever:
socks = []
while True:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socks.append(s)
print(f"{s}")
time.sleep(1)
On native wifi implementations, the latter example will fail with RuntimeError: Out of sockets after creating all available sockets.
The library could flag the error at creation time, rather than at time of (attempted) use.