views:

307

answers:

3

This is my situation:
    I have a linux server/media center with a windows client.
    My goal is to remote control rhythmbox amongst other things.
    I've done this using plink (windows based cli ssh toy).
    The problem is that starting up an ssh session logging in and sending a command is understandably slow as hell. When I had a windows server I used a tool called psexec which was almost instantaneous.

    Is there any way to speed this process up? Either somehow sending the commands with the login request which should show some improvement. Or by maintaining a persistent ssh connection which I can use. (plink dcs at the end of the command).

More info:
On my windows machine I'm using a bat like:
plink -ssh -l username -pw pass myipaddress "/home/username/bin/skip"

On my linux machine the skip bash file is something like:
//needed to get around a x11 error caused by controlling rhythmbox over ssh
if its an ssh connection
   copy the dbusaddress
fi
rhythmbox-client --next //the cli wrapper for rhythmbox


Further Research:
    The only way to go seems to keep an ssh connection open/maintained as a service. This seems doable as there is a demand due to setting up ssh tunnels (to bypass firewalls). From there I'd need a way to send the command line commands to this existing connection or reuse that connection.
    The other option is of course to NOT use ssh. Hell I already have a connection through samba file shares and there is no lag there. I bet I could put a service linux side that checks for a modified file. Then have an ap client side that modifies said file. Amazingly hacky but so far it seems like the best option. And by best I mean the only one that cuts control lag. There has got to be a better way than this, I can't be the only nerd using linux as a media-center that wants remote controls. This kind of moves the topic from stackoverflow to superuser but that's ok.

A: 

You could user an SSL certificate to get rid of the login part. Alternatively, build yourself a small HTTP server which uses an "exotic" port for controlling your media player (amarok, btw, has one build-in)

Martin Hohenberg
Changing to an ssl cert didn't change speed at all. I mean its more secure so it didn't hurt. The problem is that it needs to establish a connection which takes time. It should be possible to leave a connection open as a service. Following which I can send stuff through the command line to the open ssh connection. There are setups to keep ssh tunnels open in a service so this should be doable. And even if sending commands to an existing ssh connection isn't doable I could use something like http://www.revsys.com/writings/quicktips/ssh-faster-connections.html to open one MUCH faster.
Idiomatic
A: 

Switching to something like mpd will bypass the ssh issue, although I give no guarantee that changing tracks will be any faster.

Ignacio Vazquez-Abrams
A: 

If anyone is curious, I ended up implementing an http based server with php to execute commands server side. And client side I used curl.exe to allow me to have nice click-able buttons without the overhead of a web-browser.

Also nice since it allowed me to implement an in browser UI which is great to use from any machine with internet, ones that don't have ssh installed. And works wonderfully from my phone as a remote control (which I can use from a country away if I so chose...)

Idiomatic