I have a PHP script that needs to contact another server for information about something.
I'm currently using SSH (via
ControlMaster auto) for this, which works correctly.
However, the problem is the latency is too high -- simply
ssh example.com takes 80 milliseconds, which is far higher than the actual latency between the servers (0.2 ms, as they're connected by an Ethernet cable).
So now I'm thinking about simply passing data through the existing SSH connection rather than trying to multiplex a new SSH connection into an existing one.
However, I'm not sure how to go about this. What's the best way to pass data into the
stdin of an existing SSH connection to
example.com and then read the resulting output from its
(BASH solution is fine here -- I don't need anything PHP-specific.)