Did you know ... Search Documentation:
Predicate connect/4
 connect(+Connection, +Address, -Stream, +Options) is det[private]
Connect to Address. If the option timeout(Sec) is present, retry the connection until the timeout is reached.