Right. $sock1 did not connect, and you never know about that because you only check whether $sock connects.
In reply to Re^7: session expiry by Corion in thread session expiry by trelane