in reply to multiple socket streams

Maybe using alarm/timeout on the socket?
$SIG{'ALRM'} = sub { .. invoke the switch over to other socket .. }; my $alarmtime = "10"; sub connect_to_sock1 { ... alarm($alarmtime); ... }