Hello fellow monks,
I have been experimenting with and working around transfering a set of clients connected to a multiplexing server using IO:Select to the same script, but after it has been restarted. I had the problem initially of it not being able to reopen the port... fixed that by having a second script do the actual restarting of the script...
So, what i have now is a system call from script 1 to script 2, which then calls script 1 again. it seems way out of the way from what i think perl is capable of. that solved one problem none the less, the second problem is actually transfering the clients which are held in a hash, i initially thought that just setting the hash in the new script as the old hash may work... didnt. but i cant figure out how to resocket-ify the clients to the new script. Thats where im lost, i just need to know what would be used to resocket them. here is some of the code to show the contents of the clients hash of hashes and how it was created, hopefully enough to help.
my $ready = (IO::Select->select($select,undef,undef,undef))[0];
foreach my $s (@$ready) {
if ($s == $listener) {
my $new_sock = $listener->accept;
$clients{$new_sock} = {
socket => $new_sock,
input => '',
ip => $new_sock->peerhost
};
}
}
My ultimate goal is to be able to restart the script with any changes that have been made and keep all the clients from having to log back in.