Did you understand my reply?
I'd forgotten that SSH could tunnel connections, which, seems perfect here. Write a simple client/server interface, and then just tunnel through SSH. Keep it bound to localhost, and you won't forget.
Example: I sometimes VNC into my Linux box. (VNC = remote desktop application) However, VNC, AFAIK, does not encrypt keystrokes - very unappealing, especially if I have to send my root password. Enter SSH. I ssh into the box, and ask SSH to tunnel a VNC connection. Then I have the VNC connect to some port on localhost, which the SSH client is listening on, and it then forwards the VNC communications, encrypted, to the server. ie:
1 connection from server box to remote box - SSH, encrypted.
1 connection over loopback interface on the server box - SSH server to your server
1 connection over loopback interface on the remote box - SSH client to your custom client
EDIT: Bah, I thought this
sounded familiar. Same input, same output, lol. This is just the way I'd go about it. Anything more specific I can offer you?