Yep, this is what I already have done =)
In reply to Re^6: IO::Socket reconnect by nikita.af in thread IO::Socket reconnect by nikita.af