in reply to IO socket closed when new one is opened.
The reason the sockets close is becuase thats what IO::Socket's do when they get destroyed. And when you overwrite the previous IO::Socket stored in $remote, it gets destroyed and disconnects it self. If you don't wish this to happen, you need to keep track fo each socket individually.