in reply to
SSH2 - Asynchronous Opens & Synchronous Commands
As I tried to understand what your question really involved, it dawned on me, that maybe using an SSH client to do this, is doing it the hard way. Why not open your own direct socket connections between machines? You can also make your direct socket connections very secure using something like Net::EasyTCP.
See Glib based forking server with root messaging for a Glib eventloop based socket network. See Tk encrypted echoing-chat client and server for an example of encrypted connections.